/**
 * @module ui
 * @version 1.0
 * @copyright 2001-2019 Bitrix
 */
BX.namespace("BX.UI");if(typeof BX.UI.EntityEditorControl==="undefined"){BX.UI.EntityEditorControl=function(){this._id="";this._settings={};this._editor=null;this._parent=null;this._mode=BX.UI.EntityEditorMode.intermediate;this._modeOptions=BX.UI.EntityEditorModeOptions.none;this._model=null;this._schemeElement=null;this._container=null;this._wrapper=null;this._dragButton=null;this._dragItem=null;this._hasLayout=false;this._isValidLayout=false;this._isVisible=true;this._isActive=false;this._isChanged=false;this._isSchemeChanged=false;this._changeHandler=BX.delegate(this.onChange,this);this._contextMenuButton=null;this._isContextMenuOpened=false;this._modeChangeNotifier=null;this._configurationFieldManager=null;this._draggableContextId=""};BX.UI.EntityEditorControl.prototype={initialize:function(t,e){this._id=BX.type.isNotEmptyString(t)?t:BX.util.getRandomString(4);this._settings=e?e:{};this._editor=BX.prop.get(this._settings,"editor",null);this._parent=BX.prop.get(this._settings,"parent",null);this._model=BX.prop.get(this._settings,"model",null);this._schemeElement=BX.prop.get(this._settings,"schemeElement",null);this._container=BX.prop.getElementNode(this._settings,"container",null);var i=BX.prop.getInteger(this._settings,"mode",BX.UI.EntityEditorMode.view);if(i===BX.UI.EntityEditorMode.edit&&this._schemeElement&&!this._schemeElement.isEditable()){i=BX.UI.EntityEditorMode.view}this._mode=i;this.doInitialize();this.bindModel();this.initializeManagers()},doInitialize:function(){},bindModel:function(){},unbindModel:function(){},getMessage:function(t){var e=BX.UI.EntityEditorControl.messages;return e.hasOwnProperty(t)?e[t]:t},getId:function(){return this._id},getEditor:function(){return this._editor},setEditor:function(t){this._editor=t},getParentPosition:function(){var t=this.getParent();return t?t.getPosition():{top:0,right:0,bottom:0,left:0,width:0,height:0}},getParent:function(){return this._parent},setParent:function(t){this._parent=t},getSiblingByIndex:function(t){return this._editor?this._editor.getControlByIndex(t):null},getChildCount:function(){return 0},getChildById:function(t){return null},editChild:function(t){},removeChild:function(t){},getChildren:function(){return[]},editChildConfiguration:function(t){},areAttributesEnabled:function(){return this._schemeElement&&this._schemeElement.areAttributesEnabled()},getType:function(){return this._schemeElement?this._schemeElement.getType():""},getName:function(){return this._schemeElement?this._schemeElement.getName():""},getTitle:function(){if(!this._schemeElement){return""}var t=this._schemeElement.getTitle();if(t===""){t=this._schemeElement.getName()}return t},setTitle:function(t){if(!this._schemeElement){return}this._schemeElement.setTitle(t);this.refreshTitleLayout()},getOptionFlags:function(){return this._schemeElement?this._schemeElement.getOptionFlags():BX.UI.EntityEditorControlOptions.none},setOptionFlags:function(t){if(this._schemeElement){this._schemeElement.setOptionFlags(t)}},toggleOptionFlag:function(t){var e=this.getOptionFlags();if(BX.UI.EntityEditorControlOptions.check(e,t)){e&=~t}else{e|=t}this.setOptionFlags(e)},checkOptionFlag:function(t){return BX.UI.EntityEditorControlOptions.check(this.getOptionFlags(),t)},getData:function(){return this._schemeElement?this._schemeElement.getData():{}},getInnerConfig:function(){return this._schemeElement?this._schemeElement.getInnerConfig():{}},isVisible:function(){if(!this._isVisible){return false}if(this.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)){return true}return BX.UI.EntityEditorVisibilityPolicy.checkVisibility(this)},setVisible:function(t){t=!!t;if(this._isVisible===t){return}this._isVisible=t;if(this._hasLayout){this._wrapper.style.display=this._isVisible?"":"none"}},isActive:function(){return this._isActive},setActive:function(t){t=!!t;if(this._isActive===t){return}this._isActive=t;this.doSetActive()},doSetActive:function(){},isEditable:function(){return this._schemeElement&&this._schemeElement.isEditable()},isRequired:function(){return this._schemeElement&&this._schemeElement.isRequired()},isRequiredConditionally:function(){return this._schemeElement&&this._schemeElement.isRequiredConditionally()},isRequiredByAttribute:function(){return this._schemeElement&&this._schemeElement.isRequiredByAttribute()},isHeading:function(){return this._schemeElement&&this._schemeElement.isHeading()},getCreationPlaceholder:function(){return this._schemeElement?this._schemeElement.getCreationPlaceholder():""},getChangePlaceholder:function(){return this._schemeElement?this._schemeElement.getChangePlaceholder():""},isReadOnly:function(){return this._editor&&this._editor.isReadOnly()},isEditInViewEnabled:function(){return this._editor&&this._editor.isEditInViewEnabled()&&this.getDataBooleanParam("enableEditInView",false)},getVisibilityPolicy:function(){if(this._editor&&!this._editor.isVisibilityPolicyEnabled()){return BX.UI.EntityEditorVisibilityPolicy.always}return this._schemeElement&&this._schemeElement.getVisibilityPolicy()},getEditPriority:function(){return BX.UI.EntityEditorPriority.normal},getPosition:function(){return BX.pos(this._wrapper)},focus:function(){},save:function(){},validate:function(t){return true},rollback:function(){},getMode:function(){return this._mode},setMode:function(t,e){if(!this.canChangeMode(t)){return}var i=BX.prop.getInteger(e,"options",BX.UI.EntityEditorModeOptions.none);if(this._mode===t&&this._modeOptions===i){return}this.onBeforeModeChange();this._mode=t;this._modeOptions=i;this.doSetMode(this._mode);this.onAfterModeChange();if(BX.prop.getBoolean(e,"notify",false)){if(this._parent){this._parent.processChildControlModeChange(this)}else if(this._editor){this._editor.processControlModeChange(this)}}this._isSchemeChanged=false;this._isChanged=false;if(this._hasLayout){this._isValidLayout=false}},onBeforeModeChange:function(){},doSetMode:function(t){},onAfterModeChange:function(){if(this._modeChangeNotifier){this._modeChangeNotifier.notify()}},getModeChangeNotifier:function(){return this._modeChangeNotifier},canChangeMode:function(t){if(t===BX.UI.EntityEditorMode.edit){return this.isEditable()}return true},isModeToggleEnabled:function(){return this._editor.isModeToggleEnabled()},toggleMode:function(t,e){if(!this.isModeToggleEnabled()){return false}this.setMode(this._mode===BX.UI.EntityEditorMode.view?BX.UI.EntityEditorMode.edit:BX.UI.EntityEditorMode.view,{notify:t});if(BX.prop.getBoolean(e,"refreshLayout",true)){this.refreshLayout()}return true},isSingleEditEnabled:function(){return this.isModeToggleEnabled()&&this.isEditable()&&!this.getDataBooleanParam("enableEditInView",false)&&this.getDataBooleanParam("enableSingleEdit",true)},isEditInViewEnabled:function(){return this._editor&&this._editor.isEditInViewEnabled()&&this.getDataBooleanParam("enableEditInView",false)},isInSingleEditMode:function(){if(!this.isInEditMode()){return false}return this.checkModeOption(BX.UI.EntityEditorModeOptions.exclusive)||this.checkModeOption(BX.UI.EntityEditorModeOptions.individual)},isInEditMode:function(){return this._mode===BX.UI.EntityEditorMode.edit},isInViewMode:function(){return this._mode===BX.UI.EntityEditorMode.view},checkModeOption:function(t){return BX.UI.EntityEditorModeOptions.check(this._modeOptions,t)},getContextId:function(){return this._editor?this._editor.getContextId():""},getExternalContextId:function(){return this._editor?this._editor.getExternalContextId():""},processSchemeChange:function(){},processAvailableSchemeElementsChange:function(){},processChildControlModeChange:function(t){},processChildControlChange:function(t,e){},isChanged:function(){return this._isChanged},markAsChanged:function(t){if(typeof t==="undefined"){t={}}var e=BX.prop.get(t,"control",null);if(!(e&&e instanceof BX.UI.EntityEditorControl)){e=t["control"]=this}if(!e.isInEditMode()){return}if(!this._isChanged){this._isChanged=true}this.notifyChanged(t)},isSchemeChanged:function(){return this._isSchemeChanged},markSchemeAsChanged:function(){if(this._isSchemeChanged){return}var t=this.getParent();if(t){t.markSchemeAsChanged()}this._isSchemeChanged=true},saveScheme:function(){if(!this._isSchemeChanged){return}var t=this.getParent();if(t&&t.isSchemeChanged()){return t.saveScheme()}this.commitSchemeChanges();return this._editor.saveScheme()},commitSchemeChanges:function(){if(!this._isSchemeChanged){return}this._editor.updateSchemeElement(this._schemeElement);this._isSchemeChanged=false},getRootContainer:function(){return this._editor?this._editor.getContainer():null},getRootContainerPosition:function(){return BX.pos(this.getRootContainer())},getContainer:function(){return this._container},setContainer:function(t){this._container=t;if(this._hasLayout){this._hasLayout=false}},getWrapper:function(){return this._wrapper},enablePointerEvents:function(t){if(this._wrapper){this._wrapper.style.pointerEvents=t?"":"none"}},getModel:function(){return this._model},getSchemeElement:function(){return this._schemeElement},hasScheme:function(){return!!this._schemeElement},getDataBooleanParam:function(t,e){return this._schemeElement?this._schemeElement.getDataBooleanParam(t,e):e},hasLayout:function(){return this._hasLayout},layout:function(t){},registerLayout:function(t){if(!this._wrapper){return}this._wrapper.setAttribute("data-cid",this.getId());if(this.isInViewMode()&&this._parent&&this._parent.isInEditMode()){BX.addClass(this._wrapper,"ui-entity-editor-content-block-field-readonly")}else{BX.removeClass(this._wrapper,"ui-entity-editor-content-block-field-readonly")}if(typeof t==="undefined"){t={}}if(!BX.prop.getBoolean(t,"preservePosition",false)){var e=BX.prop.getElementNode(t,"anchor",null);if(e){BX.addClass(this._wrapper,"ui-entity-card-content-hide");this._container.insertBefore(this._wrapper,e);setTimeout(BX.delegate((function(){BX.removeClass(this._wrapper,"ui-entity-card-content-hide");BX.addClass(this._wrapper,"ui-entity-card-content-show")}),this),1);setTimeout(BX.delegate((function(){BX.removeClass(this._wrapper,"ui-entity-card-content-show")}),this),310)}else{this._container.appendChild(this._wrapper)}}this._isValidLayout=true;this.doRegisterLayout()},doRegisterLayout:function(){},needRefreshViewModeLayout:function(t){if(this._mode===BX.UI.EntityEditorMode.edit){return false}if(!this._hasLayout){return false}return true},refreshViewModeLayout:function(t){if(this.needRefreshViewModeLayout(t)){this.refreshLayout(t)}},refreshLayout:function(t){if(!this._hasLayout){return}if(!BX.type.isPlainObject(t)){t={}}t["preservePosition"]=true;this.clearLayout(t);if(BX.prop.getBoolean(t,"reset",false)){this.reset()}this.layout(t)},clearLayout:function(t){},refreshTitleLayout:function(){},releaseLayout:function(){this._wrapper=null},release:function(){},reset:function(){},onHideButtonClick:function(t){this.hide()},createHideButton:function(){var t=!this.isRequired()&&!this.isRequiredByAttribute()&&!this.isRequiredConditionally();var e=BX.create("div",{props:{className:"ui-entity-widget-content-block-hide-btn",title:this.getHideButtonHint(t)}});if(t){BX.bind(e,"click",BX.delegate(this.onHideButtonClick,this))}return e},hide:function(){if(this.isRequired()||this.isRequiredByAttribute()||this.isRequiredConditionally()){return}if(this._parent){BX.addClass(this._wrapper,"ui-entity-card-content-hide");setTimeout(BX.delegate((function(){this._parent.removeChild(this)}),this),350)}else{this.clearLayout()}},showMessageDialog:function(t,e,i){if(this._editor){this._editor.showMessageDialog(t,e,i)}},prepareSaveData:function(t){},onBeforeSubmit:function(){},onChange:function(t){this.markAsChanged()},notifyChanged:function(t){if(typeof t==="undefined"){t={}}if(this._parent){this._parent.processChildControlChange(this,t)}else if(this._editor){this._editor.processControlChange(this,t)}BX.onCustomEvent(this._editor,"onControlChanged",[this,t])},scrollIntoView:function(){var t=this.getWrapper();setTimeout((function(){var e=BX.GetDocElement(document);var i=BX.pos(t);var n=null;if(e.scrollTop>i.top-10){n=i.top-10}else if(e.scrollTop+window.innerHeight<i.bottom+10){n=i.bottom-window.innerHeight+10}if(BX.type.isNumber(n)){new BX.easing({duration:150,start:{position:e.scrollTop},finish:{position:n},step:function(t){e.scrollTop=t.position}}).animate()}}),300)},isDragEnabled:function(){if(!this._editor){return false}if(!this._editor.canChangeScheme()){return false}if(!this._schemeElement.isDragEnabled()){return false}return BX.prop.getBoolean(BX.prop.getObject(this._editor.getDragConfig(this.getDragObjectType()),"modes",{}),BX.UI.EntityEditorMode.getName(this._mode),false)},getDragObjectType:function(){return BX.UI.EditorDragObjectType.intermediate},getChildDragObjectType:function(){return BX.UI.EditorDragObjectType.intermediate},getDragScope:function(){if(this._parent){return this._parent.getChildDragScope()}if(!this._editor){return BX.UI.EditorDragScope.getDefault()}return BX.prop.getInteger(this._editor.getDragConfig(this.getDragObjectType()),"scope",BX.UI.EditorDragScope.getDefault())},getChildDragScope:function(){if(!this._editor){return BX.UI.EditorDragScope.getDefault()}return BX.prop.getInteger(this._editor.getDragConfig(this.getChildDragObjectType()),"scope",BX.UI.EditorDragScope.getDefault())},getDraggableContextId:function(){return this._draggableContextId},setDraggableContextId:function(t){this._draggableContextId=t},createDragButton:function(){return this._dragButton},isContextMenuEnabled:function(){if(this._editor&&!(this._editor.isFieldsContextMenuEnabled()&&this._editor.canChangeScheme())){return false}return this._schemeElement?this._schemeElement.isContextMenuEnabled():false},onContextMenuShow:function(){this._isContextMenuOpened=true},onContextMenuClose:function(){BX.PopupMenu.destroy(this._id)},onPopupDestroy:function(){this._isContextMenuOpened=false},createContextMenuButton:function(){this._contextMenuButton=BX.create("div",{props:{className:"ui-entity-editor-block-context-menu"},events:{click:BX.delegate(this.onContextButtonClick,this)}});return this._contextMenuButton},onContextButtonClick:function(t){if(!this._isContextMenuOpened){this.openContextMenu()}else{this.closeContextMenu()}},openContextMenu:function(){if(this._isContextMenuOpened){return}var t=this.prepareContextMenuItems();if(BX.type.isArray(t)&&t.length>0){var e=BX.delegate(this.onContextMenuItemSelect,this);for(var i=0,n=t.length;i<n;i++){if(typeof t[i]["onclick"]==="undefined"){t[i]["onclick"]=e}}BX.PopupMenu.show(this._id,this._contextMenuButton,t,{angle:false,events:{onPopupShow:BX.delegate(this.onContextMenuShow,this),onPopupClose:BX.delegate(this.onContextMenuClose,this),onPopupDestroy:BX.delegate(this.onPopupDestroy,this)}})}},closeContextMenu:function(){var t=BX.PopupMenu.getMenuById(this._id);if(t){t.popupWindow.close()}},onContextMenuItemSelect:function(t,e){this.processContextMenuCommand(t,BX.prop.getString(e,"value"))},prepareContextMenuItems:function(){return[]},processContextMenuCommand:function(t,e){},isWaitingForInput:function(){return false},initializeManagers:function(){var t={id:this.getId(),editor:this.getEditor(),type:this.getType(),configurationFieldManager:this._configurationFieldManager};BX.onCustomEvent(window,"BX.UI.EntityConfigurationManager:onInitialize",[this,t]);if(t.configurationFieldManager){this._configurationFieldManager=t.configurationFieldManager}},getConfigurationFieldManager:function(){if(this._configurationFieldManager){return this._configurationFieldManager}return this.getEditor().getConfigurationFieldManager()},createGhostNode:function(){return null},getHideButtonHint:function(t){return""}};if(typeof BX.UI.EntityEditorControl.messages==="undefined"){BX.UI.EntityEditorControl.messages={}}}if(typeof BX.UI.EntityEditorField==="undefined"){BX.UI.EntityEditorField=function(){BX.UI.EntityEditorField.superclass.constructor.apply(this);this._titleWrapper=null;this._singleEditButton=null;this._singleEditController=null;this._singleEditTimeoutHandle=0;this._viewController=null;this._singleEditButtonHandler=BX.delegate(this.onSingleEditBtnClick,this);this._validators=null;this._hasError=false;this._errorContainer=null;this._layoutAttributes=null;this._spotlight=null;this._dragObjectType=BX.UI.EditorDragObjectType.field;this.eventsNamespace="BX.UI.EntityEditorField"};BX.extend(BX.UI.EntityEditorField,BX.UI.EntityEditorControl);BX.UI.EntityEditorField.prototype.isNewEntity=function(){return this._editor&&this._editor.isNew()};BX.UI.EntityEditorField.prototype.configure=function(){if(this._parent){this._parent.editChildConfiguration(this)}};BX.UI.EntityEditorField.prototype.hasAttributeConfiguration=function(t){return this._schemeElement.hasAttributeConfiguration(t)};BX.UI.EntityEditorField.prototype.getAttributeConfiguration=function(t){return this._schemeElement.getAttributeConfiguration(t)};BX.UI.EntityEditorField.prototype.setAttributeConfiguration=function(t){return this._schemeElement.setAttributeConfiguration(t)};BX.UI.EntityEditorField.prototype.removeAttributeConfiguration=function(t){return this._schemeElement.removeAttributeConfiguration(t)};BX.UI.EntityEditorField.prototype.setVisibilityConfiguration=function(t){return this._schemeElement.setVisibilityConfiguration(t)};BX.UI.EntityEditorField.prototype.removeVisibilityConfiguration=function(t){return this._schemeElement.removeVisibilityConfiguration(t)};BX.UI.EntityEditorField.prototype.getDuplicateControlConfig=function(){return this._schemeElement?this._schemeElement.getDataObjectParam("duplicateControl",null):null};BX.UI.EntityEditorField.prototype.markAsChanged=function(t){BX.UI.EntityEditorField.superclass.markAsChanged.apply(this,arguments);if(this.hasError()){this.clearError()}var e=this.getValidators();for(var i=0,n=e.length;i<n;i++){e[i].processFieldChange(this)}};BX.UI.EntityEditorField.prototype.bindModel=function(){this._model.addChangeListener(BX.delegate(this.onModelChange,this));this._model.addLockListener(BX.delegate(this.onModelLock,this))};BX.UI.EntityEditorField.prototype.onBeforeModeChange=function(){this._layoutAttributes=null;if(this.isInEditMode()){this._layoutAttributes={animate:"show"}}};BX.UI.EntityEditorField.prototype.needRefreshViewModeLayout=function(t){if(!BX.UI.EntityEditorField.superclass.needRefreshViewModeLayout.call(this,t)){return false}var e=BX.prop.get(t,"previousModel",null);if(!e){return true}var i=this._schemeElement?this._schemeElement.getAffectedFields():[];if(!i.length){i.push(this.getDataKey())}return i.reduce(function(t,i){return t||!this.areModelValuesEqual(e,this._model,i)}.bind(this),false)};BX.UI.EntityEditorField.prototype.areModelValuesEqual=function(t,e,i){var n=t.hasField(i);var r=e.hasField(i);if(!n&&!r){return true}if(!n||!r){return false}var o=t.getField(i);var s=e.getField(i);return this.areValuesEqual(o,s)};BX.UI.EntityEditorField.prototype.areValuesEqual=function(t,e){return JSON.stringify(t)===JSON.stringify(e)};BX.UI.EntityEditorField.prototype.onModelChange=function(t,e){this.processModelChange(e)};BX.UI.EntityEditorField.prototype.onModelLock=function(t,e){this.processModelLock(e)};BX.UI.EntityEditorField.prototype.processModelChange=function(t){};BX.UI.EntityEditorField.prototype.processModelLock=function(t){};BX.UI.EntityEditorField.prototype.getMessage=function(t){var e=BX.UI.EntityEditorField.messages;return e.hasOwnProperty(t)?e[t]:BX.UI.EntityEditorField.superclass.getMessage.apply(this,arguments)};BX.UI.EntityEditorField.prototype.hasContentWrapper=function(){return this.getContentWrapper()!==null};BX.UI.EntityEditorField.prototype.getHideButtonHint=function(t){return this.getMessage(t?"hideButtonHint":"hideButtonDisabledHint")};BX.UI.EntityEditorField.prototype.getEditButton=function(){return this._singleEditButton};BX.UI.EntityEditorField.prototype.getContentWrapper=function(){return null};BX.UI.EntityEditorField.prototype.ensureWrapperCreated=function(t){if(!this._wrapper){this._wrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"}})}this.createAdditionalWrapperBlock();var e=BX.prop.getArray(t,"classNames",[]);for(var i=0,n=e.length;i<n;i++){BX.addClass(this._wrapper,e[i])}return this._wrapper};BX.UI.EntityEditorField.prototype.createAdditionalWrapperBlock=function(){if(!this._wrapper){return}var t=BX.create("div",{props:{className:"ui-entity-editor-block-before-action"},attrs:{"data-field-tag":this.getId()}});this._wrapper.appendChild(t)};BX.UI.EntityEditorField.prototype.adjustWrapper=function(){if(!this._wrapper){return}if(this.isInEditMode()&&(this.checkModeOption(BX.UI.EntityEditorModeOptions.exclusive)||this.checkModeOption(BX.UI.EntityEditorModeOptions.individual))){BX.addClass(this._wrapper,"ui-entity-editor-content-block-edit")}else{BX.removeClass(this._wrapper,"ui-entity-editor-content-block-edit")}if(this._layoutAttributes){for(var t in this._layoutAttributes){if(this._layoutAttributes.hasOwnProperty(t)){this._wrapper.setAttribute("data-"+t,this._layoutAttributes[t])}}this._layoutAttributes=null}};BX.UI.EntityEditorField.prototype.needShowTitle=function(){return this._schemeElement?this._schemeElement.needShowTitle():true};BX.UI.EntityEditorField.prototype.isVirtual=function(){return this._schemeElement?this._schemeElement.isVirtual():false};BX.UI.EntityEditorField.prototype.createTitleNode=function(t){this._titleWrapper=BX.create("div",{attrs:{className:"ui-entity-editor-block-title"}});this.prepareTitleLayout(BX.type.isNotEmptyString(t)?t:this.getTitle());return this._titleWrapper};BX.UI.EntityEditorField.prototype.prepareTitleLayout=function(t){if(!this._titleWrapper){return}var e=BX.create("label",{attrs:{className:"ui-entity-editor-block-title-text"},text:t});if(this._mode===BX.UI.EntityEditorMode.edit){BX.addClass(this._titleWrapper,"ui-entity-widget-content-block-title-edit")}var i=this.getFocusInputID();if(i!==""){BX.adjust(e,{attrs:{for:i}})}var n=this.createTitleMarker();if(n){e.appendChild(n)}var r=this.createTitleHint();if(r){e.appendChild(r);BX.UI.Hint.init(e)}var o=this.createTitleLock();if(o){BX.Dom.prepend(o,e);BX.UI.Hint.init(e)}this._titleWrapper.appendChild(e);var s=this.createTitleActionControls();if(s.length>0){var a=BX.create("span",{attrs:{className:"ui-entity-editor-block-title-actions"}});this._titleWrapper.appendChild(a);for(var l=0,d=s.length;l<d;l++){a.appendChild(s[l])}}};BX.UI.EntityEditorField.prototype.refreshTitleLayout=function(){if(!this._titleWrapper){return}BX.cleanNode(this._titleWrapper);this.prepareTitleLayout(this.getTitle())};BX.UI.EntityEditorField.prototype.createTitleMarker=function(){if(this._mode===BX.UI.EntityEditorMode.view){return null}if(this.isRequired()||this.isRequiredByAttribute()){return BX.create("span",{style:{color:"#f00"},text:"*"})}else if(this.isRequiredConditionally()){return BX.create("span",{text:"*"})}return null};BX.UI.EntityEditorField.prototype.createTitleHint=function(){var t=this._schemeElement?this._schemeElement.getHint():null;if(t){return BX.create("span",{dataset:{hint:t,hintHtml:true,hintInteractivity:true}})}return null};BX.UI.EntityEditorField.prototype.createTitleLock=function(){var t=this._schemeElement?this._schemeElement.getLockText():null;if(t&&!this.isEditable()){return BX.Tag.render`
				<span
					class="ui-btn ui-btn-link ui-btn-icon-lock ui-btn-icon-lock-entity-editor-title"
					data-hint="${BX.Text.encode(t)}"
					data-hint-no-icon="true"
				></span>
			`}return null};BX.UI.EntityEditorField.prototype.createTitleActionControls=function(){return[]};BX.UI.EntityEditorField.prototype.clearLayout=function(t){if(!this._hasLayout){return}this.releaseLightingAbilities();BX.UI.EntityEditorField.superclass.clearLayout.apply(this,arguments);if(!BX.type.isPlainObject(t)){t={}}this.releaseDragDropAbilities();this.releaseSwitchingAbilities();if(!BX.prop.getBoolean(t,"preservePosition",false)){this._wrapper=BX.remove(this._wrapper)}else{BX.removeClass(this._wrapper,"ui-entity-editor-content-block-click-editable");BX.removeClass(this._wrapper,"ui-entity-editor-content-block-click-empty");this._wrapper=BX.cleanNode(this._wrapper);if(this.hasError()){this.clearError()}}if(this._singleEditButton){this._singleEditButton=null}this.doClearLayout(t);this._hasLayout=false};BX.UI.EntityEditorField.prototype.doClearLayout=function(t){};BX.UI.EntityEditorField.prototype.registerLayout=function(t){var e=this.isVisible();var i=this.isNeedToDisplay();this._wrapper.style.display=e&&i?"":"none";this.initializeSwitchingAbilities();if(this.isInEditMode()&&this.checkModeOption(BX.UI.EntityEditorModeOptions.individual)){window.setTimeout(BX.delegate(this.focus,this),0)}BX.UI.EntityEditorField.superclass.registerLayout.apply(this,arguments);var n=BX.prop.getObject(t,"lighting",null);if(n){window.setTimeout(function(){this.initializeLightingAbilities(n)}.bind(this),1e3)}if(!i&&BX.prop.getBoolean(t,"notifyIfNotDisplayed",false)){BX.UI.Notification.Center.notify({content:BX.message("UI_ENTITY_EDITOR_FIELD_HIDDEN_IN_VIEW_MODE").replace(/#TITLE#/gi,this.getTitle()),position:"top-center",autoHideDelay:5e3})}};BX.UI.EntityEditorField.prototype.raiseLayoutEvent=function(){BX.onCustomEvent(window,this.eventsNamespace+":onLayout",[this])};BX.UI.EntityEditorField.prototype.hasContentToDisplay=function(){return this.hasValue()};BX.UI.EntityEditorField.prototype.isNeedToDisplay=function(t){if(!(this._editor&&this._editor.isExternalLayoutResolversEnabled())&&(this._mode===BX.UI.EntityEditorMode.edit||this.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)||this._schemeElement.isShownAlways())){return true}if(this._editor&&BX.prop.getBoolean(t,"enableLayoutResolvers",true)){return BX.prop.getBoolean(this._editor.prepareFieldLayoutOptions(this),"isNeedToDisplay",true)}return this.hasContentToDisplay()};BX.UI.EntityEditorField.prototype.isWaitingForInput=function(){return this.isInEditMode()&&(this.isRequired()||this.isRequiredByAttribute())&&!this.hasValue()};BX.UI.EntityEditorField.prototype.hide=function(){if(!(this.isRequired()||this.isRequiredConditionally()||this.isRequiredByAttribute())){BX.UI.EntityEditorField.superclass.hide.apply(this,arguments);BX.onCustomEvent(window,this.eventsNamespace+":onChildMenuItemDeselect",[this,arguments])}else{this.showMessageDialog("operationDenied",BX.message("UI_ENTITY_EDITOR_HIDE_TITLE"),BX.message("UI_ENTITY_EDITOR_HIDE_DENIED"))}};BX.UI.EntityEditorField.prototype.getEditPriority=function(){var t=this.hasValue();if(!t&&(this.isRequired()||this.isRequiredByAttribute()||this.isRequiredConditionally())){return BX.UI.EntityEditorPriority.high}if(!this._editor.isNew()){return BX.UI.EntityEditorPriority.normal}return t?BX.UI.EntityEditorPriority.high:this.doGetEditPriority()};BX.UI.EntityEditorField.prototype.doGetEditPriority=function(){return BX.UI.EntityEditorPriority.normal};BX.UI.EntityEditorField.prototype.checkIfNotEmpty=function(t){if(BX.type.isString(t)){return t.trim()!==""}return t!==null&&t!==undefined};BX.UI.EntityEditorField.prototype.setupFromModel=function(t,e){if(!t){t=this._model}if(!t){return}var i=this.getRelatedModelData(t);this._model.updateData(i,e)};BX.UI.EntityEditorField.prototype.getRelatedModelData=function(t){if(!t){t=this._model}if(!t){return{}}var e={};var i=this.getRelatedDataKeys();for(var n=0,r=i.length;n<r;n++){var o=i[n];if(o!==""){e[o]=t.getField(o,null)}}return e};BX.UI.EntityEditorField.prototype.getRelatedDataKeys=function(){return[this.getDataKey()]};BX.UI.EntityEditorField.prototype.hasValue=function(){return this.checkIfNotEmpty(this.getValue())};BX.UI.EntityEditorField.prototype.getValue=function(t){if(!this._model){return""}return this._model.getField(this.getDataKey(),t!==undefined?t:"")};BX.UI.EntityEditorField.prototype.getStringValue=function(t){return this._model?this._model.getStringField(this.getName(),t):""};BX.UI.EntityEditorField.prototype.getRuntimeValue=function(){return""};BX.UI.EntityEditorField.prototype.getDataKey=function(){return this.getName()};BX.UI.EntityEditorField.prototype.prepareSaveData=function(t){t[this.getDataKey()]=this.getValue()};BX.UI.EntityEditorField.prototype.findValidatorIndex=function(t){if(!this._validators){return-1}for(var e=0,i=this._validators.length;e<i;e++){if(this._validators[e]===t){return e}}return-1};BX.UI.EntityEditorField.prototype.addValidator=function(t){if(t&&this.findValidatorIndex(t)<0){if(!this._validators){this._validators=[]}this._validators.push(t)}};BX.UI.EntityEditorField.prototype.removeValidator=function(t){if(!this._validators||!t){return}var e=this.findValidatorIndex(t);if(e>=0){this._validators.splice(e,1)}};BX.UI.EntityEditorField.prototype.getValidators=function(){return this._validators?this._validators:[]};BX.UI.EntityEditorField.prototype.hasValidators=function(){return this._validators&&this._validators.length>0};BX.UI.EntityEditorField.prototype.executeValidators=function(t){if(!this._validators){return true}var e=true;for(var i=0,n=this._validators.length;i<n;i++){if(!this._validators[i].validate(t)){e=false}}return e};BX.UI.EntityEditorField.prototype.hasError=function(){return this._hasError};BX.UI.EntityEditorField.prototype.showError=function(t,e){if(!this._errorContainer){this._errorContainer=BX.create("div",{attrs:{className:"ui-entity-editor-field-error-text"}})}this._errorContainer.innerHTML=BX.util.htmlspecialchars(t);if(this._wrapper){this._wrapper.appendChild(this._errorContainer);BX.addClass(this._wrapper,"ui-entity-editor-field-error")}this._hasError=true};BX.UI.EntityEditorField.prototype.showRequiredFieldError=function(t){this.showError(BX.message("UI_ENTITY_EDITOR_REQUIRED_FIELD_ERROR"),t)};BX.UI.EntityEditorField.prototype.clearError=function(){if(!this._hasError){return}if(this._errorContainer&&this._errorContainer.parentNode){this._errorContainer.parentNode.removeChild(this._errorContainer)}BX.removeClass(this._wrapper,"ui-entity-editor-field-error");this._hasError=false};BX.UI.EntityEditorField.prototype.isContentWrapperOnScreen=function(){if(this.hasContentWrapper()){var t=BX.GetDocElement(document);var e=BX.pos(this.getContentWrapper());if(t.scrollTop<=e.top&&t.scrollTop+window.innerHeight>=e.bottom){return true}}return false};BX.UI.EntityEditorField.prototype.focus=function(){if(!this.isContentWrapperOnScreen()){this.scrollAnimate()}};BX.UI.EntityEditorField.prototype.scrollAnimate=function(){var t=BX.GetDocElement(document);var e=this._wrapper;window.setTimeout((function(){new BX.easing({duration:300,start:{position:t.scrollTop},finish:{position:BX.pos(e).top-10},step:function(e){t.scrollTop=e.position}}).animate()}),0)};BX.UI.EntityEditorField.prototype.createDragButton=function(){if(!this._dragButton){this._dragButton=BX.create("div",{props:{className:"ui-entity-editor-block-draggable-btn-container"},children:[BX.create("div",{props:{className:"ui-entity-editor-draggable-btn"}})]})}return this._dragButton};BX.UI.EntityEditorField.prototype.createGhostNode=function(){if(!this._wrapper){return null}var t=BX.pos(this._wrapper);var e=BX.create("div",{props:{className:"ui-entity-field-grabbing"},children:[this._wrapper.cloneNode(true)]});e.style.width=t.width+"px";e.style.height=t.height+"px";return e};BX.UI.EntityEditorField.prototype.setDragObjectType=function(t){this._dragObjectType=t};BX.UI.EntityEditorField.prototype.getDragObjectType=function(){return this._dragObjectType};BX.UI.EntityEditorField.prototype.initializeDragDropAbilities=function(){if(this._dragItem){return}this._dragItem=BX.UI.EditorDragItemController.create("field_"+this.getId(),{charge:BX.UI.EditorFieldDragItem.create({control:this,contextId:this._draggableContextId,scope:this.getDragScope()}),node:this.createDragButton(),showControlInDragMode:false,ghostOffset:{x:0,y:0}})};BX.UI.EntityEditorField.prototype.releaseDragDropAbilities=function(){if(this._dragItem){this._dragItem.release();this._dragItem=null}};BX.UI.EntityEditorField.prototype.prepareContextMenuItems=function(){var t=[];t.push({value:"hide",text:BX.message("UI_ENTITY_EDITOR_HIDE")});t.push({value:"configure",text:BX.message("UI_ENTITY_EDITOR_CONFIGURE")});if(this._parent&&this._parent.hasAdditionalMenu()){var e=this._parent.getAdditionalMenu();for(var i=0;i<e.length;i++){t.push(e[i])}}t.push({value:"showAlways",html:'<label class="ui-entity-card-context-menu-item-hide-empty-wrap">'+'<input type="checkbox"'+(this.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)?' checked = "true"':"")+' class="ui-entity-card-context-menu-item-hide-empty-input">'+'<span class="ui-entity-card-context-menu-item-hide-empty-text">'+BX.message("UI_ENTITY_EDITOR_SHOW_ALWAYS")+"</span></label>"});this.doPrepareContextMenuItems(t);return t};BX.UI.EntityEditorField.prototype.doPrepareContextMenuItems=function(t){};BX.UI.EntityEditorField.prototype.processContextMenuCommand=function(t,e){if(e==="showAlways"){var i=BX.getEventTarget(t);if(i&&i.tagName==="INPUT"){this.toggleOptionFlag(BX.UI.EntityEditorControlOptions.showAlways);if(this._parent){this._parent.processChildControlSchemeChange(this)}if(!this.isNeedToDisplay()){window.setTimeout(BX.delegate(this.clearLayout,this),500);var n=BX.util.htmlspecialchars(this.getTitle());BX.UI.Notification.Center.notify({content:BX.message("UI_ENTITY_EDITOR_FIELD_HIDDEN_DUE_TO_SHOW_ALWAYS_CHANGED").replace(/#TITLE#/gi,n),position:"top-center",autoHideDelay:5e3});this.closeContextMenu()}}return}if(e==="hide"){window.setTimeout(BX.delegate(this.hide,this),500)}else if(e==="configure"){this.configure()}else if(this._parent&&this._parent.hasAdditionalMenu()){this._parent.processChildAdditionalMenuCommand(this,e)}this.closeContextMenu()};BX.UI.EntityEditorField.prototype.initializeSwitchingAbilities=function(){if(this.isInViewMode()){if(this.isSingleEditEnabled()){BX.addClass(this._wrapper,"ui-entity-editor-content-block-click-editable");if(!this.hasContentToDisplay()){BX.addClass(this._wrapper,"ui-entity-editor-content-block-click-empty")}if(this._singleEditButton){BX.bind(this._singleEditButton,"click",this._singleEditButtonHandler)}}if(this.hasContentWrapper()&&BX.UI.EntityEditorModeSwitchType.check(this.getModeSwitchType(BX.UI.EntityEditorMode.edit),BX.UI.EntityEditorModeSwitchType.content)){this._viewController=BX.UI.EditorFieldViewController.create(this._id,{field:this,wrapper:this.getContentWrapper()})}}else if(this.checkModeOption(BX.UI.EntityEditorModeOptions.exclusive)){this._singleEditController=BX.UI.EditorFieldSingleEditController.create(this._id,{field:this})}};BX.UI.EntityEditorField.prototype.releaseSwitchingAbilities=function(){if(this._singleEditButton){BX.unbind(this._singleEditButton,"click",this._singleEditButtonHandler)}if(this._viewController){this._viewController.release();this._viewController=null}if(this._singleEditController){this._singleEditController.release();this._singleEditController=null}};BX.UI.EntityEditorField.prototype.initializeLightingAbilities=function(t){var e=BX.prop.getString(t,"text","");if(!BX.type.isNotEmptyString(e)){return}var i=this.getContentWrapper();if(!i){return}this._spotlight=new BX.SpotLight({id:BX.prop.getString(t,"id",""),targetElement:i,autoSave:true,content:e,targetVertex:"middle-left",zIndex:200});this._spotlight.show();var n=BX.prop.getObject(t,"events",{});for(var r in n){if(n.hasOwnProperty(r)){BX.addCustomEvent(this._spotlight,r,n[r])}}};BX.UI.EntityEditorField.prototype.releaseLightingAbilities=function(){if(this._spotlight){this._spotlight.close();this._spotlight=null}};BX.UI.EntityEditorField.prototype.getFocusInputID=function(){return""};BX.UI.EntityEditorField.prototype.onSingleEditBtnClick=function(t){if(!(this.isSingleEditEnabled()&&this._editor)){return}if(this._singleEditTimeoutHandle>0){window.clearTimeout(this._singleEditTimeoutHandle);this._singleEditTimeoutHandle=0}this._singleEditTimeoutHandle=window.setTimeout(BX.delegate(this.switchToSingleEditMode,this),250);BX.eventCancelBubble(t)};BX.UI.EntityEditorField.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button}return e};BX.UI.EntityEditorField.prototype.switchToSingleEditMode=function(){if(!(this.isSingleEditEnabled()&&this._editor)){return}this._singleEditTimeoutHandle=0;if(this._editor){this._editor.switchControlMode(this,BX.UI.EntityEditorMode.edit,BX.UI.EntityEditorModeOptions.individual)}};if(typeof BX.UI.EntityEditorField.messages==="undefined"){BX.UI.EntityEditorField.messages={}}}if(typeof BX.UI.EntityEditorSectionContentStub==="undefined"){BX.UI.EntityEditorSectionContentStub=function(){this._settings=null;this._owner=null;this._container=null;this._wrapper=null;this._clickHandler=BX.delegate(this.onClick,this)};BX.UI.EntityEditorSectionContentStub.prototype={initialize:function(t){this._settings=t?t:{};this._owner=BX.prop.get(this._settings,"owner",null);this._container=BX.prop.getElementNode(this._settings,"container",null)},layout:function(){this._wrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-card-content-nothing-selected"},children:[BX.create("div",{props:{className:"ui-entity-card-content-nothing-selected-text"},text:BX.message("UI_ENTITY_EDITOR_NOTHING_SELECTED")})]})]});BX.bind(this._wrapper,"click",this._clickHandler);if(this._container.children.length>0){this._container.insertBefore(this._wrapper,this._container.children[0])}else{this._container.appendChild(this._wrapper)}},clearLayout:function(){BX.unbind(this._wrapper,"click",this._clickHandler);this._wrapper=BX.remove(this._wrapper)},onStubClick:function(t){if(this._owner&&this._owner.isModeToggleEnabled()){this._owner.toggle()}}};BX.UI.EntityEditorSectionContentStub.create=function(t,e){var i=new BX.UI.EntityEditorSectionContentStub;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorColumn==="undefined"){BX.UI.EntityEditorColumn=function(){BX.UI.EntityEditorColumn.superclass.constructor.apply(this);this._sections=null;this._width=0;this._draggableContextId="";this._dragContainerController=null;this._dragPlaceHolder=null;this._dropHandler=BX.delegate(this.onDrop,this)};BX.extend(BX.UI.EntityEditorColumn,BX.UI.EntityEditorControl);BX.UI.EntityEditorColumn.prototype.doSetActive=function(){for(var t=0,e=this._sections.length;t<e;t++){this._sections[t].setActive(this._isActive)}};BX.UI.EntityEditorColumn.prototype.initialize=function(t,e){BX.UI.EntityEditorColumn.superclass.initialize.call(this,t,e);this.initializeFromModel();this._width=this._schemeElement.getDataIntegerParam("width",0)};BX.UI.EntityEditorColumn.prototype.initializeFromModel=function(){var t,e;if(this._sections){for(t=0,e=this._sections.length;t<e;t++){this._sections[t].release()}}this._sections=[];var i=this._schemeElement.getElements();for(t=0,e=i.length;t<e;t++){var n=i[t];var r=this._editor.createControl(n.getType(),n.getName(),{schemeElement:n,model:this._model,parent:this});if(!r){continue}n.setParent(this._schemeElement);r.setMode(this._mode,{notify:false});this._sections.push(r)}};BX.UI.EntityEditorColumn.prototype.layout=function(t){this._wrapper=BX.create("div",{props:{className:"ui-entity-editor-column-content"},style:this._width?{flex:this._width}:null});this._container.appendChild(this._wrapper);if(!BX.type.isPlainObject(t)){t={}}var e=BX.prop.getBoolean(t,"reset",false);var i=t;if(i.hasOwnProperty("anchor")){delete i.anchor}for(var n=0,r=this._sections.length;n<r;n++){var o=this._sections[n];o.setContainer(this._wrapper);o.releaseLayout();if(e){o.reset()}o.layout(i)}if(this.isDragEnabled()){this._dragContainerController=BX.UI.EditorDragContainerController.create("column_"+this.getId(),{charge:BX.UI.EditorSectionDragContainer.create({editor:this._editor,column:this}),node:this._wrapper});this._dragContainerController.addDragFinishListener(this._dropHandler)}this._hasLayout=true};BX.UI.EntityEditorColumn.prototype.clearLayout=function(){if(!this._hasLayout){return}for(var t=0,e=this._sections.length;t<e;t++){var i=this._sections[t];i.clearLayout();i.setContainer(null)}this._wrapper=BX.remove(this._wrapper);this._hasLayout=false};BX.UI.EntityEditorColumn.prototype.refreshLayout=function(t){t=BX.type.isPlainObject(t)?BX.mergeEx({},t):{};var e=BX.prop.getFunction(t,"callback",null);delete t["callback"];delete t["anchor"];if(this._wrapper&&this._wrapper.nextSibling){t["anchor"]=this._wrapper.nextSibling}this.clearLayout();this.layout(t);if(e){e()}};BX.UI.EntityEditorColumn.prototype.refreshViewModeLayout=function(t){if(this.needRefreshViewModeLayout(t)){for(var e=0,i=this._sections.length;e<i;e++){var n=this._sections[e];n.refreshViewModeLayout(t)}}};BX.UI.EntityEditorColumn.prototype.onStubClick=function(t){this.toggle()};BX.UI.EntityEditorColumn.prototype.processChildControlChange=function(t,e){if(typeof e==="undefined"){e={}}if(!BX.prop.get(e,"control",null)){e["control"]=t}if(!t.isInEditMode()&&!e["control"].isInEditMode()){return}this.markAsChanged(e);this.enableToggling(false)};BX.UI.EntityEditorColumn.prototype.enableToggling=function(t){t=!!t;if(this._enableToggling===t){return}this._enableToggling=t};BX.UI.EntityEditorColumn.prototype.toggle=function(){if(this._enableToggling&&this._editor){this._editor.switchControlMode(this,this._mode===BX.UI.EntityEditorMode.view?BX.UI.EntityEditorMode.edit:BX.UI.EntityEditorMode.view)}};BX.UI.EntityEditorColumn.prototype.onToggleBtnClick=function(t){this.toggle()};BX.UI.EntityEditorColumn.prototype.onBeforeModeChange=function(){};BX.UI.EntityEditorColumn.prototype.doSetMode=function(t){for(var e=0,i=this._sections.length;e<i;e++){this._sections[e].setMode(t,{notify:false})}};BX.UI.EntityEditorColumn.prototype.processAvailableSchemeElementsChange=function(){};BX.UI.EntityEditorColumn.prototype.validate=function(t){if(this._mode!==BX.UI.EntityEditorMode.edit){return true}var e=BX.UI.EntityAsyncValidator.create();for(var i=0,n=this._sections.length;i<n;i++){var r=this._sections[i];if(r.getMode()!==BX.UI.EntityEditorMode.edit){continue}e.addResult(r.validate(t))}return e.validate()};BX.UI.EntityEditorColumn.prototype.commitSchemeChanges=function(){if(this._isSchemeChanged){var t=[];for(var e=0,i=this._sections.length;e<i;e++){this._sections[e].commitSchemeChanges();var n=this._sections[e].getSchemeElement();if(n){t.push(n)}}this._schemeElement.setElements(t)}return BX.UI.EntityEditorColumn.superclass.commitSchemeChanges.call(this)};BX.UI.EntityEditorColumn.prototype.save=function(){for(var t=0,e=this._sections.length;t<e;t++){this._sections[t].save()}};BX.UI.EntityEditorColumn.prototype.rollback=function(){for(var t=0,e=this._sections.length;t<e;t++){this._sections[t].rollback()}if(this._isChanged){this.initializeFromModel();this._isChanged=false}};BX.UI.EntityEditorColumn.prototype.onBeforeSubmit=function(){for(var t=0,e=this._sections.length;t<e;t++){this._sections[t].onBeforeSubmit()}};BX.UI.EntityEditorColumn.prototype.getChildIndex=function(t){for(var e=0,i=this._sections.length;e<i;e++){if(this._sections[e]===t){return e}}return-1};BX.UI.EntityEditorColumn.prototype.addChild=function(t,e){if(!BX.type.isPlainObject(e)){e={}}var i=null;var n=BX.prop.getInteger(e,"index",-1);if(n>=0){this._sections.splice(n,0,t);if(n<this._sections.length-1){i=this._sections[n+1]}}else{this._sections.push(t);i=BX.prop.get(e,"related",null)}if(t.getParent()!==this){t.setParent(this)}if(t.hasScheme()){t.getSchemeElement().setParent(this._schemeElement)}t.setActive(this._isActive);if(this._hasLayout){t.setContainer(this._wrapper);var r=BX.prop.getObject(e,"layout",{});if(i){r["anchor"]=i.getWrapper()}t.layout(r)}if(t.hasScheme()){this._editor.processControlAdd(t);this.markSchemeAsChanged();if(BX.prop.getBoolean(e,"enableSaving",true)){this.saveScheme()}}};BX.UI.EntityEditorColumn.prototype.removeChild=function(t,e){if(!BX.type.isPlainObject(e)){e={}}var i=this.getChildIndex(t);if(i<0){return}if(t.isActive()){t.setActive(false)}this._sections.splice(i,1);var n=t.hasScheme();if(n){t.getSchemeElement().setParent(null)}if(this._hasLayout){t.clearLayout();t.setContainer(null)}if(n){this._editor.processControlRemove(t);this.markSchemeAsChanged();if(BX.prop.getBoolean(e,"enableSaving",true)){this.saveScheme()}}};BX.UI.EntityEditorColumn.prototype.moveChild=function(t,e,i){if(!BX.type.isPlainObject(i)){i={}}var n=this.getChildCount();var r=n-1;if(e<0||e>n){e=r}var o=this.getChildIndex(t);if(o<0||o===e){return false}if(this._hasLayout){t.clearLayout()}this._sections.splice(o,1);n--;var s=null;if(this._hasLayout){s=e<n?this._sections[e].getWrapper():null}if(e<n){this._sections.splice(e,0,t)}else{this._sections.push(t)}if(this._hasLayout){if(s){t.layout({anchor:s})}else{t.layout()}}this._editor.processControlMove(t);this.markSchemeAsChanged();if(BX.prop.getBoolean(i,"enableSaving",true)){this.saveScheme()}return true};BX.UI.EntityEditorColumn.prototype.editChild=function(t){if(this._mode===BX.UI.EntityEditorMode.edit){t.focus()}else if(!this.isReadOnly()){var e=true;for(var i=0,n=this._sections.length;i<n;i++){if(this._sections[i].getMode()!==this._mode){e=false;break}}if(e){this.setMode(BX.UI.EntityEditorMode.edit,{notify:true});this.refreshLayout({callback:function(){t.focus()}})}}};BX.UI.EntityEditorColumn.prototype.getChildById=function(t){for(var e=0,i=this._sections.length;e<i;e++){var n=this._sections[e];if(n.getId()===t){return n}var r=n.getChildById(t);if(r){return r}}return null};BX.UI.EntityEditorColumn.prototype.getChildCount=function(){return this._sections.length};BX.UI.EntityEditorColumn.prototype.getChildren=function(){return this._sections};BX.UI.EntityEditorColumn.prototype.processChildControlModeChange=function(t){if(!this.isActive()&&this._editor){this._editor.processControlModeChange(t)}};BX.UI.EntityEditorColumn.prototype.hasAdditionalMenu=function(){return false};BX.UI.EntityEditorColumn.prototype.getAdditionalMenu=function(){return[]};BX.UI.EntityEditorColumn.prototype.isWaitingForInput=function(){for(var t=0,e=this._sections.length;t<e;t++){if(this._sections[t].isWaitingForInput()){return true}}return false};BX.UI.EntityEditorColumn.prototype.isRequired=function(){for(var t=0,e=this._sections.length;t<e;t++){if(this._sections[t].isRequired()){return true}}return false};BX.UI.EntityEditorColumn.prototype.isRequiredConditionally=function(){for(var t=0,e=this._sections.length;t<e;t++){if(this._sections[t].isRequiredConditionally()){return true}}return false};BX.UI.EntityEditorColumn.prototype.getDragObjectType=function(){return BX.UI.EditorDragObjectType.section};BX.UI.EntityEditorColumn.prototype.getChildDragObjectType=function(){return BX.UI.EditorDragObjectType.field};BX.UI.EntityEditorColumn.prototype.hasPlaceHolder=function(){return!!this._dragPlaceHolder};BX.UI.EntityEditorColumn.prototype.createPlaceHolder=function(t){var e=this._sections.length;if(t<0||t>e){t=e>0?e:0}if(this._dragPlaceHolder){if(this._dragPlaceHolder.getIndex()===t){return this._dragPlaceHolder}this._dragPlaceHolder.clearLayout();this._dragPlaceHolder=null}this._dragPlaceHolder=BX.UI.EditorDragSectionPlaceholder.create({container:this._wrapper,anchor:t<e?this._sections[t].getWrapper():null,index:t});this._dragPlaceHolder.layout();return this._dragPlaceHolder};BX.UI.EntityEditorColumn.prototype.getPlaceHolder=function(){return this._dragPlaceHolder};BX.UI.EntityEditorColumn.prototype.removePlaceHolder=function(){if(this._dragPlaceHolder){this._dragPlaceHolder.clearLayout();this._dragPlaceHolder=null}};BX.UI.EntityEditorColumn.prototype.processDraggedItemDrop=function(t,e){var i=t.getCharge();if(!(i instanceof BX.UI.EditorSectionDragContainer&&i.getColumn()===this)){return}var n=e.getContextData();var r=BX.type.isNotEmptyString(n["contextId"])?n["contextId"]:"";if(r!==BX.UI.EditorSectionDragItem.contextId){return}var o=this.getPlaceHolder();var s=o?o.getIndex():-1;if(s<0){return}var a=typeof n["charge"]!=="undefined"?n["charge"]:null;if(!(a instanceof BX.UI.EditorSectionDragItem)){return}var l=a.getControl();if(!l){return}var d=l.getParent();if(d===this){var h=this.getChildIndex(l);if(h<0){return}var u=s<=h?s:s-1;if(u===h){return}this.moveChild(l,u,{enableSaving:false});this._editor.saveSchemeChanges()}else{var p=l.getSchemeElement();if(l.getMode()===BX.UI.EntityEditorMode.edit){this._editor.unregisterActiveControl(l)}d.removeChild(l,{enableSaving:false});var c=this._editor.createControl(p.getType(),p.getName(),{schemeElement:p,model:this._model,parent:this,mode:l.getMode()});this.addChild(c,{index:s});this._editor.processControlModeChange(c);this._editor.saveSchemeChanges()}};BX.UI.EntityEditorColumn.prototype.onDrop=function(t){this.processDraggedItemDrop(t.data["dropContainer"],t.data["draggedItem"])};BX.UI.EntityEditorColumn.prototype.initializeDragDropAbilities=function(){if(this._dragItem){return}this._dragItem=BX.UI.EditorDragItemController.create("section_"+this.getId(),{charge:BX.UI.EditorSectionDragItem.create({control:this}),node:this.createDragButton(),showControlInDragMode:false,ghostOffset:{x:0,y:0}})};BX.UI.EntityEditorColumn.prototype.releaseDragDropAbilities=function(){if(this._dragItem){this._dragItem.release();this._dragItem=null}};BX.UI.EntityEditorColumn.create=function(t,e){var i=new BX.UI.EntityEditorColumn;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorSection==="undefined"){BX.UI.EntityEditorSection=function(){BX.UI.EntityEditorSection.superclass.constructor.apply(this);this._fields=null;this._fieldConfigurator=null;this._mandatoryConfigurator=null;this._visibilityConfigurator=null;this._titleEditButton=null;this._titleEditHandler=BX.delegate(this.onTitleEditButtonClick,this);this._headerContainer=null;this._titleContainer=null;this._titleView=null;this._titleInput=null;this._titleActions=null;this._titleMode=BX.UI.EntityEditorMode.intermediate;this._titleInputKeyHandler=BX.delegate(this.onTitleInputKeyPress,this);this._documentClickHandler=BX.delegate(this.onExternalClick,this);this._detetionConfirmDlgId="section_deletion_confirm";this._enableToggling=true;this._toggleButton=null;this._addChildButton=null;this._buttonPanelBlockLeft=null;this._buttonPanelBlockRight=null;this._createChildButton=null;this._childSelectMenu=null;this._buttonPanelWrapper=null;this._deleteButton=null;this._deleteButtonHandler=BX.delegate(this.onDeleteSectionBtnClick,this);this._draggableContextId="";this._dragContainerController=null;this._dragPlaceHolder=null;this._dropHandler=BX.delegate(this.onDrop,this);this._fieldSelector=null;this._fieldTypeSelectMenu=null;this._stub=null;this._detailButton=null;this.eventsNamespace="BX.UI.EntityEditorSection"};BX.extend(BX.UI.EntityEditorSection,BX.UI.EntityEditorControl);BX.UI.EntityEditorSection.prototype.doSetActive=function(){for(var t=0,e=this._fields.length;t<e;t++){this._fields[t].setActive(this._isActive)}};BX.UI.EntityEditorSection.prototype.initialize=function(t,e){BX.UI.EntityEditorSection.superclass.initialize.call(this,t,e);this._draggableContextId=BX.UI.EditorFieldDragItem.contextId;if(this.getChildDragScope()===BX.UI.EditorDragScope.parent){this._draggableContextId+="_"+this.getId()}this.initializeFromModel()};BX.UI.EntityEditorSection.prototype.initializeFromModel=function(){this.release();var t=this._schemeElement.getElements();for(var e=0,i=t.length;e<i;e++){var n=t[e];var r=this._editor.createControl(n.getType(),n.getName(),{schemeElement:n,model:this._model,parent:this});if(!r){continue}n.setParent(this._schemeElement);r.setMode(this._mode,{notify:false});this._fields.push(r)}};BX.UI.EntityEditorSection.prototype.registerLayout=function(t){this._wrapper.style.display=this.isVisible()?"":"none";BX.UI.EntityEditorField.superclass.registerLayout.apply(this,arguments)};BX.UI.EntityEditorSection.prototype.layout=function(t){var e=this._schemeElement.getTitle();this._contentContainer=BX.create("div",{props:{className:"ui-entity-editor-section-content"}});var i=this._mode===BX.UI.EntityEditorMode.view;var n=i?"ui-entity-editor-section":"ui-entity-editor-section-edit";this._enableToggling=this.isModeToggleEnabled()&&this._schemeElement.getDataBooleanParam("enableToggling",true);this._toggleButton=BX.create("span",{attrs:{className:"ui-entity-editor-header-edit-lnk"},events:{click:BX.delegate(this.onToggleBtnClick,this)},text:BX.message(i?"UI_ENTITY_EDITOR_CHANGE":"UI_ENTITY_EDITOR_CANCEL")});if(!this._enableToggling){this._toggleButton.style.display="none"}var r=this.getEditor().getControlByIndex(0);var o=BX.prop.getString(this.getEditor()._settings,"entityDetailsUrl","");if(this.getEditor().isEmbedded()&&o.length){var s=null;if(r){s=r.getChildren().indexOf(this)}if(s===0){this._detailButton=BX.create("a",{attrs:{className:"ui-entity-editor-detail-btn",href:o},text:BX.message("UI_ENTITY_EDITOR_SECTION_OPEN_DETAILS")})}}this._titleMode=BX.UI.EntityEditorMode.view;this._wrapper=BX.create("div",{props:{className:n}});if(this._schemeElement.isTitleEnabled()){this._headerContainer=BX.create("div",{props:{className:"ui-entity-editor-section-header"}});if(this.isDragEnabled()){this._headerContainer.appendChild(this.createDragButton())}this._titleEditButton=BX.create("span",{props:{className:"ui-entity-editor-header-title-edit-icon"},events:{click:this._titleEditHandler}});if(!this._editor.isSectionEditEnabled()||!this._editor.canChangeScheme()){this._titleEditButton.style.display="none"}this._titleView=BX.create("span",{props:{className:"ui-entity-editor-header-title-text"},text:e});var a=this.createTitleHint();if(a){this._titleView.appendChild(a);BX.UI.Hint.init(this._titleView)}this._titleInput=BX.create("input",{props:{className:"ui-entity-editor-header-title-text"},style:{display:"none"}});this._titleActions=BX.create("div",{props:{className:"ui-entity-editor-header-actions"},children:[this._toggleButton]});if(this._detailButton){this._titleActions.appendChild(this._detailButton)}this._titleContainer=BX.create("div",{props:{className:"ui-entity-editor-header-title"},children:[this._titleView,this._titleInput,this._titleEditButton]});this._headerContainer.appendChild(this._titleContainer);this._headerContainer.appendChild(this._titleActions);this._wrapper.appendChild(this._headerContainer)}this._wrapper.appendChild(this._contentContainer);if(!BX.type.isPlainObject(t)){t={}}var l=BX.prop.getElementNode(t,"anchor",null);if(l){this._container.insertBefore(this._wrapper,l)}else{this._container.appendChild(this._wrapper)}if(i&&this._fields.length===0){this._stub=BX.UI.EntityEditorSectionContentStub.create({owner:this,container:this._contentContainer});this._stub.layout()}var d=BX.prop.getBoolean(t,"reset",false);var h=BX.prop.get(t,"userFieldLoader",null);if(!h){h=BX.UI.EntityUserFieldLayoutLoader.create(this._id,{mode:this._mode,enableBatchMode:true,owner:this})}var u=BX.prop.getBoolean(t,"enableFocusGain",true);var p=BX.prop.getObject(t,"lighting",null);var c=false;var y=false;var E=null;for(var f=0,_=this._fields.length;f<_;f++){var g=this._fields[f];g.setContainer(this._contentContainer);g.setDraggableContextId(this._draggableContextId);g.releaseLayout();if(d){g.reset()}var m={userFieldLoader:h};if(!c&&p&&g.isVisible()&&g.isNeedToDisplay()){m["lighting"]=p;c=true}g.layout(m);if(u&&!i&&g.isHeading()){E=g}if(!y&&g.isContextMenuEnabled()){y=true}}if(y){BX.addClass(this._contentContainer,"ui-entity-editor-section-content-padding-right")}if(h.getOwner()===this){h.runBatch()}this._addChildButton=this._createChildButton=this._deleteButton=null;if(this._editor.canChangeScheme()&&this._schemeElement.getDataBooleanParam("showButtonPanel",true)){this.showButtonPanel()}if(this.isDragEnabled()){this._dragContainerController=BX.UI.EditorDragContainerController.create("section_"+this.getId(),{charge:BX.UI.EditorFieldDragContainer.create({section:this,context:this._draggableContextId}),node:this._wrapper});this._dragContainerController.addDragFinishListener(this._dropHandler);this.initializeDragDropAbilities()}var B=null;if(r){B=r.getChildren().indexOf(this)}var X={id:this._id,customNodes:[],visible:true,serialNumber:B};BX.onCustomEvent(window,this.eventsNamespace+":onLayout",[this,X]);if(this._titleActions&&BX.type.isArray(X["customNodes"])){for(var I=0,C=X["customNodes"].length;I<C;I++){var U=X["customNodes"][I];if(BX.type.isElementNode(U)){this._titleActions.appendChild(U)}}}if("visible"in X&&BX.type.isBoolean(X["visible"])){this.setVisible(X["visible"])}this.registerLayout(t);this._hasLayout=true;if(E){E.focus(E.getDataBooleanParam("selected",false))}};BX.UI.EntityEditorSection.prototype.clearLayout=function(){if(!this._hasLayout){return}if(this._dragContainerController){this._dragContainerController.removeDragFinishListener(this._dropHandler);this._dragContainerController.release();this._dragContainerController=null}this.releaseDragDropAbilities();if(this._stub!==null){this._stub.clearLayout();this._stub=null}for(var t=0,e=this._fields.length;t<e;t++){var i=this._fields[t];i.clearLayout();i.setContainer(null)}this._buttonPanelWrapper=BX.remove(this._buttonPanelWrapper);this._stub=null;this._wrapper=BX.remove(this._wrapper);this._hasLayout=false};BX.UI.EntityEditorSection.prototype.refreshLayout=function(t){t=BX.type.isPlainObject(t)?BX.mergeEx({},t):{};var e=BX.prop.getFunction(t,"callback",null);delete t["callback"];delete t["anchor"];if(this._wrapper&&this._wrapper.nextSibling){t["anchor"]=this._wrapper.nextSibling}this.clearLayout();this.layout(t);if(e){e()}};BX.UI.EntityEditorSection.prototype.refreshViewModeLayout=function(t){if(this.needRefreshViewModeLayout(t)){for(var e=0,i=this._fields.length;e<i;e++){var n=this._fields[e];n.refreshViewModeLayout(t)}}};BX.UI.EntityEditorSection.prototype.release=function(){var t,e;if(this._fields){for(t=0,e=this._fields.length;t<e;t++){this._fields[t].release()}}this._fields=[]};BX.UI.EntityEditorSection.prototype.onStubClick=function(t){this.toggle()};BX.UI.EntityEditorSection.prototype.adjustButtons=function(){var t=this._editor.hasAvailableSchemeElements();var e=this._editor.hasTransferableElements([this.getName()]);if(this._addChildButton){this._addChildButton.style.display=t||e?"":"none"}};BX.UI.EntityEditorSection.prototype.processChildAdditionalMenuCommand=function(t,e){};BX.UI.EntityEditorSection.prototype.ensureButtonPanelCreated=function(){if(!this._buttonPanelWrapper){this._buttonPanelWrapper=BX.create("div",{props:{className:"ui-entity-card-content-actions-container"}});this._contentContainer.appendChild(this._buttonPanelWrapper);this._buttonPanelBlockLeft=BX.create("div",{props:{className:"ui-entity-card-content-actions-block"}});this._buttonPanelWrapper.appendChild(this._buttonPanelBlockLeft);this._buttonPanelBlockRight=BX.create("div",{props:{className:"ui-entity-card-content-actions-block"}});this._buttonPanelWrapper.appendChild(this._buttonPanelBlockRight)}};BX.UI.EntityEditorSection.prototype.showButtonPanel=function(){this.ensureButtonPanelCreated();if(this._schemeElement.getDataBooleanParam("isChangeable",true)){if(this.getConfigurationFieldManager().isSelectionEnabled()){this._addChildButton=BX.create("span",{props:{className:"ui-entity-editor-content-add-lnk"},text:BX.message("UI_ENTITY_EDITOR_SELECT_FIELD"),events:{click:BX.delegate(this.onAddChildBtnClick,this)}});this.addButtonElement(this._addChildButton,{position:"left"})}if(this.getConfigurationFieldManager().isCreationEnabled()){this._createChildButton=BX.create("span",{props:{className:"ui-entity-editor-content-create-lnk"},text:BX.message("UI_ENTITY_EDITOR_CREATE_FIELD"),events:{click:BX.delegate(this.onCreateFieldBtnClick,this)}});this.addButtonElement(this._createChildButton,{position:"left"})}}if(this._schemeElement.getDataBooleanParam("isRemovable",true)){var t="ui-entity-editor-content-remove-lnk";if(this.isRequired()||this.isRequiredByAttribute()||this.isRequiredConditionally()){t="ui-entity-editor-content-remove-lnk-disabled"}this._deleteButton=BX.create("span",{props:{className:t},text:BX.message("UI_ENTITY_EDITOR_DELETE_SECTION")});this.addButtonElement(this._deleteButton,{position:"right"});BX.bind(this._deleteButton,"click",this._deleteButtonHandler)}this._contentContainer.appendChild(this._buttonPanelWrapper);this.adjustButtons()};BX.UI.EntityEditorSection.prototype.addButtonElement=function(t,e){this.ensureButtonPanelCreated();if(BX.prop.getString(e,"position","")==="left"){this._buttonPanelBlockLeft.appendChild(t)}else{this._buttonPanelBlockRight.appendChild(t)}};BX.UI.EntityEditorSection.prototype.setTitleMode=function(t){if(this._titleMode===t){return}this._titleMode=t;if(!this._schemeElement.isTitleEnabled()){return}if(this._titleMode===BX.UI.EntityEditorMode.view){this._titleView.style.display="";this._titleInput.style.display="none";this._titleEditButton.style.display="";var e=this._titleInput.value;this._titleView.innerHTML=BX.util.htmlspecialchars(e);this._schemeElement.setTitle(e);this.markSchemeAsChanged();this.saveScheme();BX.unbind(this._titleInput,"keyup",this._titleInputKeyHandler);BX.unbind(window.document,"click",this._documentClickHandler)}else{this._titleView.style.display="none";this._titleInput.style.display="";this._titleEditButton.style.display="none";this._titleInput.value=this._schemeElement.getTitle();BX.bind(this._titleInput,"keyup",this._titleInputKeyHandler);this._titleInput.focus();window.setTimeout(BX.delegate((function(){BX.bind(window.document,"click",this._documentClickHandler)}),this),100)}};BX.UI.EntityEditorSection.prototype.toggleTitleMode=function(){this.setTitleMode(this._titleMode===BX.UI.EntityEditorMode.view?BX.UI.EntityEditorMode.edit:BX.UI.EntityEditorMode.view)};BX.UI.EntityEditorSection.prototype.onTitleEditButtonClick=function(t){if(this._editor.isSectionEditEnabled()){this.toggleTitleMode()}};BX.UI.EntityEditorSection.prototype.onTitleInputKeyPress=function(t){if(!t){t=window.event}if(t.keyCode===13){this.toggleTitleMode()}};BX.UI.EntityEditorSection.prototype.onExternalClick=function(t){if(!t){t=window.event}if(this._titleInput!==BX.getEventTarget(t)){this.toggleTitleMode()}};BX.UI.EntityEditorSection.prototype.enableToggling=function(t){t=!!t;if(this._enableToggling===t){return}this._enableToggling=t;if(this._hasLayout){this._toggleButton.style.display=this._enableToggling?"":"none"}};BX.UI.EntityEditorSection.prototype.toggle=function(){if(this._enableToggling&&this._editor){this._editor.switchControlMode(this,this._mode===BX.UI.EntityEditorMode.view?BX.UI.EntityEditorMode.edit:BX.UI.EntityEditorMode.view)}};BX.UI.EntityEditorSection.prototype.onToggleBtnClick=function(t){this.toggle()};BX.UI.EntityEditorSection.prototype.onBeforeModeChange=function(){};BX.UI.EntityEditorSection.prototype.doSetMode=function(t){this.removeFieldConfigurator();if(this._titleMode===BX.UI.EntityEditorMode.edit){this.toggleTitleMode()}for(var e=0,i=this._fields.length;e<i;e++){this._fields[e].setMode(t,{notify:false})}};BX.UI.EntityEditorSection.prototype.processAvailableSchemeElementsChange=function(){};BX.UI.EntityEditorSection.prototype.validate=function(t){if(this._mode!==BX.UI.EntityEditorMode.edit){return true}var e=BX.UI.EntityAsyncValidator.create();for(var i=0,n=this._fields.length;i<n;i++){var r=this._fields[i];if(r.getMode()!==BX.UI.EntityEditorMode.edit){continue}e.addResult(r.validate(t))}return e.validate()};BX.UI.EntityEditorSection.prototype.commitSchemeChanges=function(){if(this._isSchemeChanged){var t=[];for(var e=0,i=this._fields.length;e<i;e++){var n=this._fields[e].getSchemeElement();if(n){t.push(n)}}this._schemeElement.setElements(t)}return BX.UI.EntityEditorSection.superclass.commitSchemeChanges.call(this)};BX.UI.EntityEditorSection.prototype.save=function(){for(var t=0,e=this._fields.length;t<e;t++){this._fields[t].save()}};BX.UI.EntityEditorSection.prototype.rollback=function(){for(var t=0,e=this._fields.length;t<e;t++){this._fields[t].rollback()}if(this._isChanged){this.initializeFromModel();this._isChanged=false}};BX.UI.EntityEditorSection.prototype.onBeforeSubmit=function(){for(var t=0,e=this._fields.length;t<e;t++){this._fields[t].onBeforeSubmit()}};BX.UI.EntityEditorSection.prototype.getChildIndex=function(t){for(var e=0,i=this._fields.length;e<i;e++){if(this._fields[e]===t){return e}}return-1};BX.UI.EntityEditorSection.prototype.addChild=function(t,e){if(!BX.type.isPlainObject(e)){e={}}var i=null;var n=BX.prop.getInteger(e,"index",-1);if(n>=0){this._fields.splice(n,0,t);if(n<this._fields.length-1){i=this._fields[n+1]}}else{this._fields.push(t);i=BX.prop.get(e,"related",null)}if(t.getParent()!==this){t.setParent(this)}if(t.hasScheme()){t.getSchemeElement().setParent(this._schemeElement)}t.setActive(this._isActive);if(this._hasLayout){if(this._stub!==null){this._stub.clearLayout();this._stub=null}t.setContainer(this._contentContainer);var r=BX.prop.getObject(e,"layout",{});if(i){r["anchor"]=i.getWrapper()}else{r["anchor"]=this._buttonPanelWrapper}if(BX.prop.getBoolean(r,"forceDisplay",false)&&!t.isNeedToDisplay()&&!t.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)){t.toggleOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)}t.layout(r);if(!BX.hasClass(this._contentContainer,"ui-entity-editor-section-content-padding-right")&&t.isContextMenuEnabled()){BX.addClass(this._contentContainer,"ui-entity-editor-section-content-padding-right")}}var o=BX.prop.getBoolean(e,"scrollIntoView",false);if(o){t.scrollIntoView()}if(t.hasScheme()){this._editor.processControlAdd(t);this.markSchemeAsChanged();if(BX.prop.getBoolean(e,"enableSaving",true)){this.saveScheme()}}};BX.UI.EntityEditorSection.prototype.removeChild=function(t,e){if(!BX.type.isPlainObject(e)){e={}}var i=this.getChildIndex(t);if(i<0){return}if(t.isActive()){t.setActive(false)}this._fields.splice(i,1);var n=t.hasScheme();if(n){t.getSchemeElement().setParent(null)}if(this._hasLayout){t.clearLayout();t.setContainer(null);if(this.isInViewMode()){if(this._fields.length>0){if(this._stub!==null){this._stub.clearLayout();this._stub=null}}else{if(this._stub===null){this._stub=BX.UI.EntityEditorSectionContentStub.create({owner:this,container:this._contentContainer})}this._stub.layout()}}}if(n){this._editor.processControlRemove(t);this.markSchemeAsChanged();if(BX.prop.getBoolean(e,"enableSaving",true)){this.saveScheme()}}};BX.UI.EntityEditorSection.prototype.moveChild=function(t,e,i){if(!BX.type.isPlainObject(i)){i={}}var n=this.getChildCount();var r=n-1;if(e<0||e>n){e=r}var o=this.getChildIndex(t);if(o<0||o===e){return false}if(this._hasLayout){t.clearLayout()}this._fields.splice(o,1);n--;var s=null;if(this._hasLayout){s=e<n?this._fields[e].getWrapper():this._buttonPanelWrapper}if(e<n){this._fields.splice(e,0,t)}else{this._fields.push(t)}if(this._hasLayout){if(s){t.layout({anchor:s})}else{t.layout()}}this._editor.processControlMove(t);this.markSchemeAsChanged();if(BX.prop.getBoolean(i,"enableSaving",true)){this.saveScheme()}return true};BX.UI.EntityEditorSection.prototype.editChild=function(t){if(this._mode===BX.UI.EntityEditorMode.edit){t.focus()}else if(!this.isReadOnly()){var e=true;for(var i=0,n=this._fields.length;i<n;i++){if(this._fields[i].getMode()!==this._mode){e=false;break}}if(e){this.setMode(BX.UI.EntityEditorMode.edit,{notify:true});this.refreshLayout({callback:function(){t.focus()}})}}};BX.UI.EntityEditorSection.prototype.getChildById=function(t){for(var e=0,i=this._fields.length;e<i;e++){var n=this._fields[e];if(n.getId()===t){return n}}return null};BX.UI.EntityEditorSection.prototype.getChildCount=function(){return this._fields.length};BX.UI.EntityEditorSection.prototype.getChildren=function(){return this._fields};BX.UI.EntityEditorSection.prototype.editChildConfiguration=function(t){this.removeFieldConfigurator();this.createFieldConfigurator({field:t,enableMandatoryControl:this.getConfigurationFieldManager().isMandatoryControlEnabled()})};BX.UI.EntityEditorSection.prototype.processChildControlModeChange=function(t){if(!this.isActive()&&this._editor){this._editor.processControlModeChange(t)}};BX.UI.EntityEditorSection.prototype.processChildControlSchemeChange=function(t){this.markSchemeAsChanged();this.saveScheme()};BX.UI.EntityEditorSection.prototype.processSchemeChange=function(){this.adjustButtons()};BX.UI.EntityEditorSection.prototype.onAddChildBtnClick=function(t){this.openAddChildMenu()};BX.UI.EntityEditorSection.prototype.openAddChildMenu=function(){var t=this._editor.getAvailableSchemeElements();var e=t.length;var i=[];for(var n=0;n<e;n++){var r=t[n];if(r){var o=r.getData();if(o.doNotDisplayInShowFieldList){continue}}i.push({text:r.getTitle(),value:r.getName()})}if(this._editor.hasTransferableElements([this.getName()])){if(e>0){i.push({delimiter:true})}i.push({text:BX.message("UI_ENTITY_EDITOR_SELECT_FIELD_FROM_OTHER_SECTION"),value:"ACTION.TRANSFER"})}var s={id:this._id,menuItems:i,button:this._addChildButton,cancel:false};BX.onCustomEvent(window,this.eventsNamespace+":onOpenChildMenu",[this,s]);if(s["cancel"]){return}if(this._childSelectMenu){this._childSelectMenu.setupItems(i)}else{this._childSelectMenu=BX.UI.SelectorMenu.create(this._id,{items:i});this._childSelectMenu.addOnSelectListener(BX.delegate(this.onChildSelect,this))}this._childSelectMenu.open(this._addChildButton)};BX.UI.EntityEditorSection.prototype.processChildControlChange=function(t,e){if(!t.isInEditMode()){return}if(typeof e==="undefined"){e={}}if(!BX.prop.get(e,"control",null)){e["control"]=t}this.markAsChanged(e);this.enableToggling(false)};BX.UI.EntityEditorSection.prototype.onChildSelect=function(t){var e=t.data["item"];var i={id:this._id,item:e,button:this._addChildButton,cancel:false};BX.onCustomEvent(window,this.eventsNamespace+":onChildMenuItemSelect",[this,i]);if(i["cancel"]){return}var n=e.getValue();if(n==="ACTION.TRANSFER"){this.openTransferDialog();return}var r=this._editor.getAvailableSchemeElementByName(n);if(!r){return}var o=this._editor.createControl(r.getType(),r.getName(),{schemeElement:r,model:this._model,parent:this,mode:this._mode});if(o){this.addChild(o,{layout:{forceDisplay:true}})}};BX.UI.EntityEditorSection.prototype.openTransferDialog=function(){if(!this._fieldSelector){this._fieldSelector=BX.UI.EntityEditorFieldSelector.create(this._id,{scheme:this._editor.getScheme(),excludedNames:[this.getSchemeElement().getName()],title:BX.message("UI_ENTITY_EDITOR_FIELD_TRANSFER_DIALOG_TITLE"),buttonTitle:this._settings.editor._entityTypeTitle,useFieldsSearch:this._settings.editor._useFieldsSearch});this._fieldSelector.addClosingListener(BX.delegate(this.onTransferFieldSelect,this))}this._fieldSelector.open()};BX.UI.EntityEditorSection.prototype.onTransferFieldSelect=function(t){if(t.data["isCanceled"]){return}var e=BX.prop.getArray(t.data,"items");if(e.length===0){return}for(var i=0,n=e.length;i<n;i++){var r=e[i];var o=BX.prop.getString(r,"sectionName","");var s=BX.prop.getString(r,"fieldName","");var a=this._editor.getControlById(o);if(!a){continue}var l=a.getChildById(s);if(!l){continue}var d=l.getSchemeElement();a.removeChild(l,{enableSaving:false});var h=this._editor.createControl(d.getType(),d.getName(),{schemeElement:d,model:this._model,parent:this,mode:this._mode});this.addChild(h,{layout:{forceDisplay:true},enableSaving:false})}this._editor.saveSchemeChanges()};BX.UI.EntityEditorSection.prototype.createFieldConfigurator=function(t){if(!BX.type.isPlainObject(t)){throw"EntityEditorSection: The 'params' argument must be object."}t.mandatoryConfigurator=null;var e=BX.prop.get(t,"field",null);var i=this._editor.getAttributeManager();if(i){t.mandatoryConfigurator=i.createFieldConfigurator(e,BX.UI.EntityFieldAttributeType.required)}this._fieldConfigurator=this.getConfigurationFieldManager().createFieldConfigurator(t,this);this.addChild(this._fieldConfigurator,{related:e,scrollIntoView:true});if(this._fieldConfigurator instanceof BX.UI.EntityEditorUserFieldConfigurator){this._mandatoryConfigurator=t.mandatoryConfigurator;BX.addCustomEvent(this._fieldConfigurator,"onSave",BX.delegate(this.onUserFieldConfigurationSave,this));BX.addCustomEvent(this._fieldConfigurator,"onCancel",BX.delegate(this.onFieldConfigurationCancel,this))}else{BX.addCustomEvent(this._fieldConfigurator,"onSave",BX.delegate(this.onFieldConfigurationSave,this));BX.addCustomEvent(this._fieldConfigurator,"onCancel",BX.delegate(this.onFieldConfigurationCancel,this))}};BX.UI.EntityEditorSection.prototype.removeFieldConfigurator=function(){if(this._fieldConfigurator){var t=this._fieldConfigurator.getField();if(t){t.setVisible(true)}this.removeChild(this._fieldConfigurator);this._fieldConfigurator=null}};BX.UI.EntityEditorSection.prototype.onFieldConfigurationSave=function(t,e){if(t!==this._fieldConfigurator){return}var i=BX.prop.get(e,"field",null);if(!i){BX.onCustomEvent(this._editor,this._editor.eventsNamespace+":onFieldCreate",[this,e]);this.removeFieldConfigurator();return}var n=BX.prop.getString(e,"label","");var r=BX.prop.getBoolean(e,"showAlways",null);if(n===""&&r===null){this.removeFieldConfigurator();this._mandatoryConfigurator=null;this._visibilityConfigurator=null;return}this._fieldConfigurator.setLocked(true);i.getSchemeElement().setTitle(n);if(r!==null&&r!==i.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)){i.toggleOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)}BX.onCustomEvent(this._editor,this._editor.eventsNamespace+":onFieldModify",[this,e]);this.markSchemeAsChanged();this.saveScheme().then(BX.delegate((function(){if(this._mandatoryConfigurator){if(this._mandatoryConfigurator.isPermitted()&&i.areAttributesEnabled()&&!i.isRequired()){if(this._mandatoryConfigurator.isEnabled()){if(this._mandatoryConfigurator.isChanged()){this._mandatoryConfigurator.acceptChanges()}var t=this._mandatoryConfigurator.getConfiguration();this._editor.getAttributeManager().saveConfiguration(t,i.getName());i.setAttributeConfiguration(t)}else{var e=this._mandatoryConfigurator.getTypeId();this._editor.getAttributeManager().removeConfiguration(e,i.getName());i.removeAttributeConfiguration(e)}}this._mandatoryConfigurator=null;this._visibilityConfigurator=null}this.removeFieldConfigurator();i.setTitle(n)}),this));var o=BX.prop.getString(e,"typeId");if(o==="list"){var s={typeId:o};s["innerConfig"]=BX.prop.getObject(e,"innerConfig",{});s["enumeration"]=BX.prop.getArray(e,"enumeration",[]);if(BX.Type.isPlainObject(s["innerConfig"])&&s["innerConfig"].hasOwnProperty("controller")&&BX.Type.isStringFilled(s["innerConfig"]["controller"])){BX.ajax.runAction(s["innerConfig"]["controller"],{data:{configData:s}}).then(function(t){if(BX.Type.isObject(t)&&t.hasOwnProperty("status")&&t.status==="success"&&t.hasOwnProperty("data")&&BX.Type.isArray(t["data"])){var i=BX.prop.get(e,"field",null);if(BX.Type.isObject(i)){var n=t["data"];var r=[];for(var o=0;o<n.length;o++){r.push({NAME:n[o]["VALUE"],VALUE:n[o]["ID"]})}i.getSchemeElement().setDataParam("items",r);i.setItems();i.refreshLayout()}}else{console.error("Invalid server response.")}}.bind(this),function(t){if(BX.Type.isObject(t)&&t.hasOwnProperty("status")&&t["status"]==="error"&&t.hasOwnProperty("errors")&&BX.Type.isArray(t["errors"])&&t["errors"].length>0&&BX.Type.isPlainObject(t["errors"][0])&&t["errors"][0].hasOwnProperty("message")&&BX.Type.isString(t["errors"][0]["message"])){console.error(t["errors"][0]["message"])}else{console.error("Invalid server response.")}}.bind(this))}}};BX.UI.EntityEditorSection.prototype.onFieldConfigurationCancel=function(t,e){if(t!==this._fieldConfigurator){return}this.removeFieldConfigurator();this._mandatoryConfigurator=null;this._visibilityConfigurator=null};BX.UI.EntityEditorSection.prototype.enablePointerEvents=function(t){if(!this._fields){return}t=!!t;for(var e=0,i=this._fields.length;e<i;e++){this._fields[e].enablePointerEvents(t)}};BX.UI.EntityEditorSection.prototype.onCreateFieldBtnClick=function(t){if(!this._fieldTypeSelectMenu){var e=this.getConfigurationFieldManager().getTypeInfos();var i=[];for(var n=0,r=e.length;n<r;n++){var o=e[n];i.push({value:o.name,text:o.title,legend:o.legend,callback:!!o.callback?o.callback:null})}this._fieldTypeSelectMenu=BX.UI.UserFieldTypeMenu.create(this._id,{items:i,callback:BX.delegate(this.onFieldTypeSelect,this)})}this._fieldTypeSelectMenu.open(this._createChildButton)};BX.UI.EntityEditorSection.prototype.getCreationConfigurator=function(t){return this.createFieldConfigurator({typeId:t,enableMandatoryControl:this.getConfigurationFieldManager().isMandatoryControlEnabled()})};BX.UI.EntityEditorSection.prototype.onFieldTypeSelect=function(t,e){this._fieldTypeSelectMenu.close();var i=e.getValue();if(i===""){return}if(this.getConfigurationFieldManager().hasExternalForm(i)){this.getConfigurationFieldManager().openCreationPageUrl(i)}else{this.removeFieldConfigurator();this.getCreationConfigurator(i)}};BX.UI.EntityEditorSection.prototype.onUserFieldConfigurationSave=function(t,e){if(t!==this._fieldConfigurator){return}this._fieldConfigurator.setLocked(true);var i=BX.prop.getString(e,"typeId");if(i===BX.UI.EntityUserFieldType.datetime&&!BX.prop.getBoolean(e,"enableTime",false)){i=BX.UI.EntityUserFieldType.date}var n={USER_TYPE_ID:i};if(this._mandatoryConfigurator&&this._mandatoryConfigurator.isPermitted()&&this._mandatoryConfigurator.isEnabled()&&this._mandatoryConfigurator.isCustomized()){if(this._mandatoryConfigurator.isChanged()){this._mandatoryConfigurator.acceptChanges()}n["MANDATORY"]="N"}else{n["MANDATORY"]=BX.prop.getBoolean(e,"mandatory",false)?"Y":"N"}var r=BX.prop.get(e,"settings",null);if(r){n["SETTINGS"]=r}var o=BX.prop.getBoolean(e,"showAlways",null);var s=BX.prop.getString(e,"label","");var a=BX.prop.get(e,"field",null);if(a){var l=a.getTitle();if(s!==""||o!==null){a.setTitle(s);if(o!==null&&o!==a.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)){a.toggleOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)}this.markSchemeAsChanged();this.saveScheme()}if(!this.getEditor().canChangeCommonConfiguration()){if(o!==null){this._editor.setOption("show_always",o?"Y":"N")}BX.delegate(this.onUserFieldUpdate,this);this.removeFieldConfigurator();return}n["FIELD"]=a.getName();n["ENTITY_VALUE_ID"]=a.getEntityValueId();if(this._editor.getConfigScope()===BX.UI.EntityConfigScope.common&&s!==""&&l!==s){n["EDIT_FORM_LABEL"]=n["LIST_COLUMN_LABEL"]=n["LIST_FILTER_LABEL"]=s}n["VALUE"]=a.getFieldValue();if(i===BX.UI.EntityUserFieldType.enumeration){n["ENUM"]=BX.prop.getArray(e,"enumeration",[]);n["SETTINGS"]["DISPLAY"]=BX.prop.getString(e,"display","UI")}if(i===BX.UI.EntityUserFieldType.enumeration||i===BX.UI.EntityUserFieldType.crmStatus){n["SETTINGS"]["DISPLAY"]=BX.prop.getString(e,"display","UI")}a.adjustFieldParams(n,false);var d=function(){this._editor.getUserFieldManager().updateField(n,a.getMode()).then(BX.delegate(this.onUserFieldUpdate,this))}.bind(this);if(i===BX.UI.EntityUserFieldType.crmStatus){var h={};h.DISPLAY=BX.prop.getString(e,"display","UI");var u={typeId:i,innerConfig:BX.prop.getObject(e,"innerConfig",{}),enumeration:BX.prop.getArray(e,"enumeration",[]),SETTINGS:h};if(BX.Type.isPlainObject(u["innerConfig"])&&u["innerConfig"].hasOwnProperty("controller")&&BX.Type.isStringFilled(u["innerConfig"]["controller"])){BX.ajax.runAction(u["innerConfig"]["controller"],{data:{configData:u}}).then(function(t){if(!(BX.Type.isObject(t)&&t.hasOwnProperty("status")&&t.status==="success"&&t.hasOwnProperty("data")&&BX.Type.isArray(t["data"]))){console.error("Invalid server response.")}d()}.bind(this),function(t){if(BX.Type.isObject(t)&&t.hasOwnProperty("status")&&t["status"]==="error"&&t.hasOwnProperty("errors")&&BX.Type.isArray(t["errors"])&&t["errors"].length>0&&BX.Type.isPlainObject(t["errors"][0])&&t["errors"][0].hasOwnProperty("message")&&BX.Type.isString(t["errors"][0]["message"])){console.error(t["errors"][0]["message"])}else{console.error("Invalid server response.")}d()}.bind(this))}else{d()}}else{d()}}else{if(o!==null){this._editor.setOption("show_always",o?"Y":"N")}n["EDIT_FORM_LABEL"]=n["LIST_COLUMN_LABEL"]=n["LIST_FILTER_LABEL"]=BX.prop.getString(e,"label");n["MULTIPLE"]=BX.prop.getBoolean(e,"multiple",false)?"Y":"N";if(i===BX.UI.EntityUserFieldType.enumeration){n["ENUM"]=BX.prop.getArray(e,"enumeration",[]);n["SETTINGS"]["DISPLAY"]=BX.prop.getString(e,"display","UI")}if(i===BX.UI.EntityUserFieldType.enumeration||i===BX.UI.EntityUserFieldType.crmStatus){n["SETTINGS"]["DISPLAY"]=BX.prop.getString(e,"display","UI")}this._editor.getUserFieldManager().createField(n,this._mode).then(BX.delegate(this.onUserFieldCreate,this))}};BX.UI.EntityEditorSection.prototype.onUserFieldCreate=function(t){if(!BX.type.isPlainObject(t)){return}this.removeFieldConfigurator();var e=this._editor.getUserFieldManager();for(var i in t){if(!t.hasOwnProperty(i)){continue}var n=t[i];var r=BX.prop.getObject(n,"FIELD",null);if(!r){continue}var o=e.createSchemeElement(r);if(!o){continue}this._model.registerNewField(o.getName(),{VALUE:"",SIGNATURE:BX.prop.getString(r,"SIGNATURE","")});var s=this._editor.createControl(o.getType(),o.getName(),{schemeElement:o,model:this._model,parent:this,mode:this._mode});if(this._mandatoryConfigurator&&this._mandatoryConfigurator.isPermitted()&&this._mandatoryConfigurator.isEnabled()&&this._mandatoryConfigurator.isCustomized()){var a=this._mandatoryConfigurator.getConfiguration();this._editor.getAttributeManager().saveConfiguration(a,o.getName());s.setAttributeConfiguration(a)}if(this._visibilityConfigurator){var l={accessCodes:this._visibilityConfigurator.formatAccessCodesFromConfig(this._visibilityConfigurator.getItems())};this._visibilityConfigurator.onUserFieldConfigurationSave(o.getName(),this._editor.getEntityTypeId());s.setVisibilityConfiguration(l)}var d=this._editor.getOption("show_always","Y")==="Y";if(d!==s.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)){s.toggleOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)}this.addChild(s,{layout:{notifyIfNotDisplayed:true,html:BX.prop.getString(n,"HTML","")}});break}this._mandatoryConfigurator=null;this._visibilityConfigurator=null};BX.UI.EntityEditorSection.prototype.onUserFieldUpdate=function(t){if(!BX.type.isPlainObject(t)){return}this.removeFieldConfigurator();var e=this._editor.getUserFieldManager();for(var i in t){if(!t.hasOwnProperty(i)){continue}var n=t[i];var r=BX.prop.getObject(n,"FIELD",null);if(!r){continue}var o=this.getChildById(i);if(!o){continue}var s=o.getSchemeElement();if(!s){continue}if(this._mandatoryConfigurator&&this._mandatoryConfigurator.isPermitted()){if(this._mandatoryConfigurator.isEnabled()&&this._mandatoryConfigurator.isCustomized()){var a=this._mandatoryConfigurator.getConfiguration();this._editor.getAttributeManager().saveConfiguration(a,s.getName());o.setAttributeConfiguration(a)}else{var l=this._mandatoryConfigurator.getTypeId();this._editor.getAttributeManager().removeConfiguration(l,s.getName());o.removeAttributeConfiguration(l)}}if(this._visibilityConfigurator){var d={accessCodes:this._visibilityConfigurator.formatAccessCodesFromConfig(this._visibilityConfigurator.getItems())};this._visibilityConfigurator.onUserFieldConfigurationSave(s.getName(),this._editor.getEntityTypeId());o.setVisibilityConfiguration(d)}e.updateSchemeElement(s,r);var h={};var u=BX.prop.getString(n,"HTML","");if(u!==""){h["html"]=u}o.refreshLayout(h);break}this._mandatoryConfigurator=null;this._visibilityConfigurator=null};BX.UI.EntityEditorSection.prototype.onDeleteConfirm=function(t){if(BX.prop.getBoolean(t,"cancel",true)){return}if(this.getParent()){this.getParent().removeChild(this)}else{this._editor.removeSchemeElement(this.getSchemeElement());this._editor.removeControl(this);this._editor.saveScheme()}};BX.UI.EntityEditorSection.prototype.onDeleteSectionBtnClick=function(t){if(this.isRequired()||this.isRequiredByAttribute()||this.isRequiredConditionally()){this.showMessageDialog("operationDenied",BX.message("UI_ENTITY_EDITOR_DELETE_SECTION"),BX.message("UI_ENTITY_EDITOR_DELETE_SECTION_DENIED"));return}var e=BX.UI.ConfirmationDialog.get(this._detetionConfirmDlgId);if(!e){e=BX.UI.ConfirmationDialog.create(this._detetionConfirmDlgId,{title:BX.message("UI_ENTITY_EDITOR_DELETE_SECTION"),content:BX.message("UI_ENTITY_EDITOR_DELETE_SECTION_CONFIRM")})}e.open().then(BX.delegate(this.onDeleteConfirm,this))};BX.UI.EntityEditorSection.prototype.createDragButton=function(){if(!this._dragButton){this._dragButton=BX.create("div",{props:{className:"ui-entity-editor-header-draggable-btn-container"},children:[BX.create("div",{props:{className:"ui-entity-editor-draggable-btn"}})]})}return this._dragButton};BX.UI.EntityEditorSection.prototype.createGhostNode=function(){if(!this._wrapper){return null}var t=BX.pos(this._wrapper);var e=BX.create("div",{props:{className:"ui-entity-section-grabbing"},children:[BX.create("div",{props:{className:"ui-entity-editor-section-header"},children:[BX.create("div",{props:{className:"ui-entity-editor-header-draggable-btn-container"},children:[BX.create("div",{props:{className:"ui-entity-editor-draggable-btn"}})]}),BX.create("div",{props:{className:"ui-entity-editor-header-title"},children:[BX.create("span",{props:{className:"ui-entity-editor-header-title-text"},text:this._schemeElement.getTitle()})]})]})]});BX.addClass(e,"ui-entity-card-card-drag");e.style.width=t.width+"px";return e};BX.UI.EntityEditorSection.prototype.getDragObjectType=function(){return BX.UI.EditorDragObjectType.section};BX.UI.EntityEditorSection.prototype.getChildDragObjectType=function(){return BX.UI.EditorDragObjectType.field};BX.UI.EntityEditorSection.prototype.hasPlaceHolder=function(){return!!this._dragPlaceHolder};BX.UI.EntityEditorSection.prototype.createPlaceHolder=function(t){this.enablePointerEvents(false);if(this._stub!==null){this._stub.clearLayout();this._stub=null}var e=this.getChildCount();if(t<0||t>e){t=e>0?e:0}if(this._dragPlaceHolder){if(this._dragPlaceHolder.getIndex()===t){return this._dragPlaceHolder}this._dragPlaceHolder.clearLayout();this._dragPlaceHolder=null}this._dragPlaceHolder=BX.UI.EditorDragFieldPlaceholder.create({container:this._contentContainer,anchor:t<e?this._fields[t].getWrapper():this._buttonPanelWrapper,index:t});this._dragPlaceHolder.layout();return this._dragPlaceHolder};BX.UI.EntityEditorSection.prototype.getPlaceHolder=function(){return this._dragPlaceHolder};BX.UI.EntityEditorSection.prototype.removePlaceHolder=function(){this.enablePointerEvents(true);if(this.isInViewMode()&&this.getChildCount()===0&&this._stub==null){this._stub=BX.UI.EntityEditorSectionContentStub.create({owner:this,container:this._contentContainer});this._stub.layout()}if(this._dragPlaceHolder){this._dragPlaceHolder.clearLayout();this._dragPlaceHolder=null}};BX.UI.EntityEditorSection.prototype.processDraggedItemDrop=function(t,e){var i=t.getCharge();if(!(i instanceof BX.UI.EditorFieldDragContainer&&i.getSection()===this)){return}var n=e.getContextData();var r=BX.type.isNotEmptyString(n["contextId"])?n["contextId"]:"";if(r!==this.getDraggableContextId()){return}var o=this.getPlaceHolder();var s=o?o.getIndex():-1;if(s<0){return}var a=typeof n["charge"]!=="undefined"?n["charge"]:null;if(!(a instanceof BX.UI.EditorFieldDragItem)){return}var l=a.getControl();if(!l){return}var d=l.getParent();if(d===this){var h=this.getChildIndex(l);if(h<0){return}var u=s<=h?s:s-1;if(u===h){return}this.moveChild(l,u,{enableSaving:false});this._editor.saveSchemeChanges()}else{var p=l.getSchemeElement();d.removeChild(l,{enableSaving:false});var c=this._editor.createControl(p.getType(),p.getName(),{schemeElement:p,model:this._model,parent:this,mode:this._mode});if(this._mode===BX.UI.EntityEditorMode.view&&!c.hasContentToDisplay()&&!c.checkOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)){c.toggleOptionFlag(BX.UI.EntityEditorControlOptions.showAlways)}this.addChild(c,{index:s,enableSaving:false});this._editor.saveSchemeChanges()}};BX.UI.EntityEditorSection.prototype.onDrop=function(t){this.processDraggedItemDrop(t.data["dropContainer"],t.data["draggedItem"])};BX.UI.EntityEditorSection.prototype.initializeDragDropAbilities=function(){if(this._dragItem){return}this._dragItem=BX.UI.EditorDragItemController.create("section_"+this.getId(),{charge:BX.UI.EditorSectionDragItem.create({control:this}),node:this.createDragButton(),showControlInDragMode:false,ghostOffset:{x:0,y:0}})};BX.UI.EntityEditorSection.prototype.releaseDragDropAbilities=function(){if(this._dragItem){this._dragItem.release();this._dragItem=null}};BX.UI.EntityEditorSection.prototype.hasAdditionalMenu=function(){return false};BX.UI.EntityEditorSection.prototype.getAdditionalMenu=function(){return[]};BX.UI.EntityEditorSection.prototype.isWaitingForInput=function(){for(var t=0,e=this._fields.length;t<e;t++){if(this._fields[t].isWaitingForInput()){return true}}return false};BX.UI.EntityEditorSection.prototype.isRequired=function(){for(var t=0,e=this._fields.length;t<e;t++){if(this._fields[t].isRequired()){return true}}return false};BX.UI.EntityEditorSection.prototype.isRequiredConditionally=function(){for(var t=0,e=this._fields.length;t<e;t++){if(this._fields[t].isRequiredConditionally()){return true}}return false};BX.UI.EntityEditorSection.prototype.isRequiredByAttribute=function(){for(var t=0,e=this._fields.length;t<e;t++){if(this._fields[t].isRequiredByAttribute()){return true}}return false};BX.UI.EntityEditorSection.prototype.ensureButtonPanelWrapperCreated=function(){if(!this._hasLayout){throw"EntityEditorSection: Control does not have layout."}if(!this._buttonPanelWrapper){this._buttonPanelWrapper=BX.create("div",{props:{className:"ui-entity-card-content-actions-container"}});this._contentContainer.appendChild(this._buttonPanelWrapper)}return this._buttonPanelWrapper};BX.UI.EntityEditorSection.prototype.createTitleHint=function(){var t=this._schemeElement?this._schemeElement.getHint():null;if(t){return BX.create("span",{dataset:{hint:t,hintHtml:true,hintInteractivity:true}})}return null};BX.UI.EntityEditorSection.create=function(t,e){var i=new BX.UI.EntityEditorSection;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorIncludedArea==="undefined"){BX.UI.EntityEditorIncludedArea=function(){this._settings=null;this._owner=null;this._container=null;this._wrapper=null;this._loadedHtml=null;this._hasLayout=false};BX.extend(BX.UI.EntityEditorIncludedArea,BX.UI.EntityEditorSection);BX.UI.EntityEditorIncludedArea.prototype.layout=function(){if(this._hasLayout){return}if(!this._wrapper){this._wrapper=BX.create("div",{props:{className:"ui-entity-editor-included-area"},attrs:{"data-name":this.getName()}})}this._includedAreaContainer=BX.create("div",{attrs:{className:"ui-entity-editor-included-area-container"},children:[BX.create("div",{attrs:{className:"ui-entity-editor-included-area-container-loader"}})]});this._contentContainer=BX.create("div",{attrs:{className:"ui-entity-editor-included-area-content-block"},children:[this._includedAreaContainer]});this._wrapper.appendChild(this._contentContainer);this._container.appendChild(this._wrapper);this.loadArea();if(this._editor.canChangeScheme()&&this._schemeElement.getDataBooleanParam("showButtonPanel",true)){this.showButtonPanel()}this._hasLayout=true};BX.UI.EntityEditorIncludedArea.prototype.clearLayout=function(){this._buttonPanelWrapper=BX.remove(this._buttonPanelWrapper);this._wrapper=BX.remove(this._wrapper);this._hasLayout=false};BX.UI.EntityEditorIncludedArea.prototype.loadArea=function(){if(this._includedAreaContainer&&this._loadedHtml){BX.html(this._includedAreaContainer,this._loadedHtml);return}var t=this._schemeElement.getDataStringParam("action");if(!BX.type.isNotEmptyString(t)){return}var e=this.prepareConfigForAction();BX.onCustomEvent(window,"BX.UI.EntityEditorIncludedArea:onBeforeLoad",[this,e]);if(this._schemeElement.getDataStringParam("type","")==="component"){var i=this._schemeElement.getDataStringParam("componentName","");if(!BX.type.isNotEmptyString(i)){return}e.mode=this._schemeElement.getDataStringParam("mode","ajax");BX.ajax.runComponentAction(i,t,e).then(this.onLoadAreaSuccess.bind(this))}else{BX.ajax.runAction(t,e).then(this.onLoadAreaSuccess.bind(this))}};BX.UI.EntityEditorIncludedArea.prototype.prepareConfigForAction=function(){var t={};var e=this._schemeElement.getDataStringParam("dataName","");if(BX.type.isNotEmptyString(e)){var i=this._model.getField(e,{});if(BX.type.isPlainObject(i)){t.data=i}}var n=this._schemeElement.getDataStringParam("signedParametersName","");if(BX.type.isNotEmptyString(n)){var r=this._model.getField(n,"");if(BX.type.isNotEmptyString(r)){t.signedParameters=r}}return t};BX.UI.EntityEditorIncludedArea.prototype.onLoadAreaSuccess=function(t){this._loadedHtml=BX.prop.getString(BX.prop.getObject(t,"data",{}),"html",null);BX.html(this._includedAreaContainer,this._loadedHtml);BX.onCustomEvent(window,"BX.UI.EntityEditorIncludedArea:onAfterLoad",[this])};BX.UI.EntityEditorIncludedArea.create=function(t,e){var i=new BX.UI.EntityEditorIncludedArea;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorText==="undefined"){BX.UI.EntityEditorText=function(){BX.UI.EntityEditorText.superclass.constructor.apply(this);this._input=null;this._innerWrapper=null};BX.extend(BX.UI.EntityEditorText,BX.UI.EntityEditorField);BX.UI.EntityEditorText.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorText.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorText.prototype.focus=function(t){if(!this._input){return}BX.focus(this._input);if(Boolean(t)){this._input.select()}else{BX.UI.EditorTextHelper.getCurrent().setPositionAtEnd(this._input)}};BX.UI.EntityEditorText.prototype.getLineCount=function(){return this._schemeElement.getDataIntegerParam("lineCount",1)};BX.UI.EntityEditorText.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-text"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getTitle();var i=this.getValue();this._input=null;this._inputContainer=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(e));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:this.getEditModeHtmlNodes()})}else{this._wrapper.appendChild(this.createTitleNode(e));if(this.hasContentToDisplay()){if(this.getLineCount()>1){this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},html:BX.util.nl2br(BX.util.htmlspecialchars(i))})]})}else{this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},text:i})]})}}else{this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},text:BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")})}}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorText.prototype.getEditModeHtmlNodes=function(){var t=this.getValue();var e=this.getLineCount();this._inputContainer=BX.create("div",{attrs:{className:"ui-ctl ui-ctl-textbox ui-ctl-w100"}});if(e>1){this._input=BX.create("textarea",{props:{className:"ui-entity-editor-field-textarea",rows:e,value:t}})}else{this._input=BX.create("input",{attrs:{className:"ui-ctl-element",type:"text",value:t,id:this._id.toLowerCase()+"_text"}})}if(!this.isVirtual()){this._input.name=this.getName()}this._inputContainer.appendChild(this._input);if(this.isNewEntity()){var i=this.getCreationPlaceholder();if(i!==""){this._input.setAttribute("placeholder",i)}}BX.bind(this._input,"input",this._changeHandler);return[this._input]};BX.UI.EntityEditorText.prototype.doClearLayout=function(t){this._input=null;this._innerWrapper=null};BX.UI.EntityEditorText.prototype.refreshLayout=function(){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorText.superclass.refreshLayout.apply(this,arguments);return}if(this._mode===BX.UI.EntityEditorMode.edit&&this._input){this._input.value=this.getValue()}else if(this._mode===BX.UI.EntityEditorMode.view&&this._innerWrapper){this._innerWrapper.innerHTML=BX.util.htmlspecialchars(this.getValue())}};BX.UI.EntityEditorText.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?BX.util.trim(this._input.value):""};BX.UI.EntityEditorText.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._input)){throw"BX.UI.EntityEditorText. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return e};BX.UI.EntityEditorText.prototype.showError=function(t,e){BX.UI.EntityEditorText.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorText.prototype.clearError=function(){BX.UI.EntityEditorText.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorText.prototype.save=function(){if(this._input){this._model.setField(this.getName(),this._input.value,{originator:this})}};BX.UI.EntityEditorText.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorText.prototype.getFocusInputID=function(){return this._id.toLowerCase()+"_text"};BX.UI.EntityEditorText.create=function(t,e){var i=new BX.UI.EntityEditorText;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorMultiText==="undefined"){BX.UI.EntityEditorMultiText=function(){BX.UI.EntityEditorMultiText.superclass.constructor.apply(this);this._items=null;this._input=null;this._select=null;this._inputValue=[];this._addInputHandler=BX.delegate(this.addInputField,this);this._innerWrapper=null;this._isOpened=false};BX.extend(BX.UI.EntityEditorMultiText,BX.UI.EntityEditorField);BX.UI.EntityEditorMultiText.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorMultiText.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorMultiText.prototype.hasContentToDisplay=function(){var t=this.getValue();if(!BX.type.isArray(t)||t.length===0){return false}var e=t.filter((function(t){return BX.type.isNotEmptyString(""+t)}));return e.length>0};BX.UI.EntityEditorMultiText.prototype.getLineCount=function(){return this._schemeElement.getDataIntegerParam("lineCount",1)};BX.UI.EntityEditorMultiText.prototype.createSingleInput=function(t){var e=BX.create("div",{attrs:{className:"ui-ctl ui-ctl-textbox ui-ctl-w100"}});if(this.getLineCount()>1){e.appendChild(BX.create("textarea",{props:{className:"ui-ctl-element ui-entity-editor-field-textarea",name:this.getName()+"[]",rows:this.getLineCount(),value:t||""},events:{input:this._changeHandler}}))}else{e.appendChild(BX.create("input",{attrs:{name:this.getName()+"[]",className:"ui-ctl-element",type:"text",value:t||""},events:{input:this._changeHandler}}))}return e};BX.UI.EntityEditorMultiText.prototype.getCloneButton=function(){return BX.create("input",{attrs:{type:"button",value:BX.message("UI_ENTITY_EDITOR_ADD")},events:{click:this._addInputHandler}})};BX.UI.EntityEditorMultiText.prototype.addInputField=function(t){if(BX.type.isDomNode(this._inputContainer)){var e=this.createSingleInput();this._inputContainer.appendChild(e);e.querySelector(".ui-ctl-element").focus()}};BX.UI.EntityEditorMultiText.prototype.onChange=function(t){this._inputValue=[];for(var e=0;e<this._inputContainer.children.length;e++){var i=this._inputContainer.children[e].querySelector("input");if(BX.type.isDomNode(i)&&i.value!==""){this._inputValue.push(i.value)}}this.markAsChanged()};BX.UI.EntityEditorMultiText.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-multitext"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getTitle();var i=this.getValue();this._inputValue=i;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(e));this._inputContainer=BX.create("div");if(i.length>0){for(var n=0,r=i.length;n<r;n++){this._inputContainer.appendChild(this.createSingleInput(i[n]))}}else{var o=this.createSingleInput();this._inputContainer.appendChild(o);if(this.isNewEntity()){var s=this.getCreationPlaceholder();if(s!==""){this._input.setAttribute("placeholder",s)}}}this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._inputContainer,this.getCloneButton()]})}else{this._wrapper.appendChild(this.createTitleNode(e));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this.getViewInnerLayout()]})}this._wrapper.appendChild(this._innerWrapper);if(o){var a=o.querySelector(".ui-ctl-element");if(a){a.focus()}}if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorMultiText.prototype.getViewInnerLayout=function(){var t=BX.create("div",{props:{className:"ui-entity-editor-content-block-text"}});if(!this.hasContentToDisplay()){t.innerHTML=BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")}else{var e=this.getValue();for(var i=0;i<e.length;i++){t.appendChild(this.getSingleViewItem(e[i]))}}return t};BX.UI.EntityEditorMultiText.prototype.getSingleViewItem=function(t){return BX.create("p",{text:t})};BX.UI.EntityEditorMultiText.prototype.doClearLayout=function(t){this._select=null;this._innerWrapper=null};BX.UI.EntityEditorMultiText.prototype.refreshLayout=function(){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorMultiText.superclass.refreshLayout.apply(this,arguments);return}var t=this.getValue();if(this._mode===BX.UI.EntityEditorMode.edit&&this._inputContainer){for(var e=0,i=t.length;e<i;e++){this._inputContainer.appendChild(this.createSingleInput(t[e]))}}else if(this._mode===BX.UI.EntityEditorMode.view&&this._innerWrapper){this._innerWrapper.innerHTML="";this._innerWrapper.appendChild(this.getViewInnerLayout())}};BX.UI.EntityEditorMultiText.prototype.validate=function(t){if(this._mode!==BX.UI.EntityEditorMode.edit){throw"BX.UI.EntityEditorMultiText. Invalid validation context"}if(!this.isEditable()){return true}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=true;if(this._inputContainer){var i=this._inputContainer.querySelectorAll("input");for(var n=0;n<i.length;n++){if(BX.util.trim(i[n].value)!==""){e=false}}}var r=!this.isRequired()||!e;if(!r){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return r};BX.UI.EntityEditorMultiText.prototype.showError=function(t,e){BX.UI.EntityEditorMultiText.superclass.showError.apply(this,arguments);if(this._inputContainer){for(var i=0;this._inputContainer.children.length<i;i++){BX.addClass(this._inputContainer.children[i],"ui-ctl-danger")}}};BX.UI.EntityEditorMultiText.prototype.clearError=function(){BX.UI.EntityEditorMultiText.superclass.clearError.apply(this);for(var t=0;this._inputContainer.children.length<t;t++){BX.removeClass(this._inputContainer.children[t],"ui-ctl-danger")}};BX.UI.EntityEditorMultiText.prototype.save=function(){if(!this.isEditable()){return}this._model.setField(this.getName(),this._inputValue)};BX.UI.EntityEditorMultiText.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorMultiText.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?this._inputValue:""};BX.UI.EntityEditorMultiText.prototype.getValue=function(){var t=BX.UI.EntityEditorBoolean.superclass.getValue.apply(this);if(!BX.type.isArray(t)&&t!==""){return[t]}return t};BX.UI.EntityEditorMultiText.create=function(t,e){var i=new BX.UI.EntityEditorMultiText;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorMultiMoney==="undefined"){BX.UI.EntityEditorMultiMoney=function(){BX.UI.EntityEditorMultiMoney.superclass.constructor.apply(this);this._currencyEditor=[];this._amountInput=[];this._currencyInput=[];this._sumElement=[];this._select=[];this._selectContainer=[];this._selectIcon=[];this._inputValue=[];this._selectedCurrencyValue=[];this._addInputHandler=BX.delegate(this.addInputField,this);this._inputWrapper=null;this._innerWrapper=null;this._isCurrencyMenuOpened=false;BX.UI.EntityEditorMoney.superclass.constructor.apply(this);this.wrapperClassName="ui-entity-editor-field-money"};BX.extend(BX.UI.EntityEditorMultiMoney,BX.UI.EntityEditorMultiText);BX.UI.EntityEditorMultiMoney.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorMultiMoney.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorMultiMoney.prototype.hasContentToDisplay=function(){var t=this.getValue();if(!BX.type.isArray(t)||t.length===0){return false}var e=t.filter((function(t){return BX.type.isNotEmptyString(""+t)}));return e.length>0};BX.UI.EntityEditorMultiMoney.prototype.getLineCount=function(){return this._schemeElement.getDataIntegerParam("lineCount",1)};BX.UI.EntityEditorMultiMoney.prototype.createSingleInput=function(t){var e=this.getData();var i=BX.prop.getString(e,"amount");var n=BX.prop.getString(BX.prop.getObject(e,"currency"),"name");var r=this._model.getField(BX.prop.getString(BX.prop.getObject(e,"currency"),"name",""),[]);if(!BX.type.isNotEmptyString(r[t])){r[t]=BX.Currency.Editor.getBaseCurrencyId()}var o=this._editor.findOption(r[t],BX.prop.getArray(BX.prop.getObject(e,"currency"),"items"));var s=this.getAmountFieldName();var a=this.getCurrencyFieldName();var l=this._model.getField(s,"");var d=this._model.getField(BX.prop.getString(e,"formatted"),"");this._selectedCurrencyValue.push(r[t]);this._amountValue.push(BX.create("input",{attrs:{name:i+"[]",type:"hidden",value:l[t]}}));this._amountInput.push(BX.create("input",{attrs:{className:"ui-ctl-inline ui-ctl-element ui-ctl-w75",type:"text",value:d[t]}}));BX.bind(this._amountInput[t],"input",this._changeHandler);if(this._model.isFieldLocked(s)){this._amountInput[t].disabled=true}this._currencyInput.push(BX.create("input",{attrs:{name:n+"[]",type:"hidden",value:r[t]}}));var h={props:{className:"ui-ctl-element"},text:o};this._select.push(BX.create("div",h));this._selectIcon.push(BX.create("div",{attrs:{className:"ui-ctl-after ui-ctl-icon-angle"}}));this._selectContainer.push(BX.create("div",{props:{className:"ui-ctl ui-ctl-inline ui-ctl-after-icon ui-ctl-dropdown ui-ctl-w33"},children:[this._select[t],this._selectIcon[t]]}));if(this._model.isFieldLocked(a)){this._selectContainer[t].disabled=true}else{BX.bind(this._selectContainer[t],"click",BX.delegate((function(e){this.onSelectorClick(e,t)}),this))}var u=BX.create("div",{props:{className:"ui-ctl-inline ui-ctl-w100"},children:[this._amountValue[t],this._currencyInput[t],this._amountInput[t],this._selectContainer[t]]});var p=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[u]});this._currencyEditor[t]=new BX.Currency.Editor({input:this._amountInput[t],currency:r[t],callback:BX.delegate((function(e){this.onAmountValueChange(e,t)}),this)});this._currencyEditor[t].changeValue();return p};BX.UI.EntityEditorMultiMoney.prototype.getCloneButton=function(){return BX.create("input",{attrs:{type:"button",value:BX.message("UI_ENTITY_EDITOR_ADD")},events:{click:this._addInputHandler}})};BX.UI.EntityEditorMultiMoney.prototype.addInputField=function(t){if(BX.type.isDomNode(this._inputContainer)){var e=this.createSingleInput(this._amountInput.length);this._inputContainer.appendChild(e);e.querySelector(".ui-ctl-element").focus()}};BX.UI.EntityEditorMultiMoney.prototype.getAmountFieldName=function(){return this._schemeElement.getDataStringParam("amount","")};BX.UI.EntityEditorMultiMoney.prototype.getCurrencyFieldName=function(){return BX.prop.getString(this._schemeElement.getDataObjectParam("currency",{}),"name","")};BX.UI.EntityEditorMultiMoney.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-multitext"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getTitle();var i=this.getValue();this._amountValue=[];this._amountInput=[];this._currencyInput=[];this._selectContainer=[];this._innerWrapper=null;this._sumElement=[];if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(e));this._inputContainer=BX.create("div");if(i.length>0){for(var n=0,r=i.length;n<r;n++){this._inputContainer.appendChild(this.createSingleInput(n))}}else{var o=this.createSingleInput(0);this._inputContainer.appendChild(o);if(this.isNewEntity()){var s=this.getCreationPlaceholder();if(s!==""){this._input.setAttribute("placeholder",s)}}}this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._inputContainer,this.getCloneButton()]})}else{this._wrapper.appendChild(this.createTitleNode(e));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this.getViewInnerLayout()]})}this._wrapper.appendChild(this._innerWrapper);if(o){var a=o.querySelector(".ui-ctl-element");if(a){a.focus()}}if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorMultiMoney.prototype.onSelectorClick=function(t,e){this.openCurrencyMenu(e)};BX.UI.EntityEditorMultiMoney.prototype.openCurrencyMenu=function(t){if(this._isCurrencyMenuOpened){return}var e=this._schemeElement.getData();var i=BX.prop.getArray(BX.prop.getObject(e,"currency"),"items");var n=0;var r=[];while(n<i.length){r.push({text:BX.util.htmlspecialchars(i[n]["NAME"]),value:BX.util.htmlspecialchars(i[n]["VALUE"]),onclick:BX.delegate(this.onCurrencySelect,this)});n++}BX.PopupMenu.show(this._id,this._selectContainer[t],r,{angle:false,width:this._selectContainer[t].offsetWidth+"px",index:t,events:{onPopupShow:BX.delegate(this.onCurrencyMenuOpen,this),onPopupClose:BX.delegate(this.onCurrencyMenuClose,this)}})};BX.UI.EntityEditorMultiMoney.prototype.closeCurrencyMenu=function(){if(!this._isCurrencyMenuOpened){return}var t=BX.PopupMenu.getMenuById(this._id);if(t){t.popupWindow.close()}};BX.UI.EntityEditorMultiMoney.prototype.onCurrencyMenuOpen=function(){BX.addClass(this._selectContainer,"active");this._isCurrencyMenuOpened=true};BX.UI.EntityEditorMultiMoney.prototype.onCurrencyMenuClose=function(){BX.PopupMenu.destroy(this._id);BX.removeClass(this._selectContainer,"active");this._isCurrencyMenuOpened=false};BX.UI.EntityEditorMultiMoney.prototype.onCurrencySelect=function(t,e){this.closeCurrencyMenu();if(!(e&&e["menuWindow"]&&e["menuWindow"]["params"]&&BX.type.isInteger(e["menuWindow"]["params"]["index"]))){return}var i=e["menuWindow"]["params"]["index"];this._selectedCurrencyValue[i]=this._currencyInput[i].value=e.value;this._select[i].innerHTML=BX.util.htmlspecialchars(e.text);if(this._currencyEditor[i]){this._currencyEditor[i].setCurrency(this._selectedCurrencyValue[i])}this.markAsChanged({fieldName:this.getCurrencyFieldName(),fieldValue:this._selectedCurrencyValue[i]})};BX.UI.EntityEditorMultiMoney.prototype.onAmountValueChange=function(t,e){if(!this._amountValue[e]){return}var i=BX.prop.getObject(BX.Currency.Editor.currencyList,this._selectedCurrencyValue[e],null);if(i){t=BX.Currency.Editor.getFormattedValue(t,this._selectedCurrencyValue[e]);t=t.replaceAll(i["SEPARATOR"],"")}this._amountValue[e].value=t};BX.UI.EntityEditorMultiMoney.prototype.getViewInnerLayout=function(){var t=BX.create("div",{props:{className:"ui-entity-editor-content-block-text"}});if(!this.hasContentToDisplay()){t.innerHTML=BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")}else{var e=this.getValue();for(var i=0;i<e.length;i++){t.appendChild(this.getSingleViewItem(i))}}return t};BX.UI.EntityEditorMultiMoney.prototype.getSingleViewItem=function(t){return BX.create("p",{html:this.renderMoney(t),props:{className:"ui-entity-editor-content-block-wallet"}})};BX.UI.EntityEditorMultiMoney.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._amountInput&&this._amountValue)){throw"BX.UI.EntityEditorMultiMoney. Invalid validation context"}if(!this.isEditable()){return true}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=true;if(this._inputContainer){var i=this._inputContainer.querySelectorAll("input");for(var n=0;n<i.length;n++){if(BX.util.trim(i[n].value)!==""){e=false}}}var r=!this.isRequired()||!e;if(!r){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return r};BX.UI.EntityEditorMultiMoney.prototype.renderMoney=function(t){var e=this._schemeElement.getData();var i=this._model.getField(BX.prop.getString(BX.prop.getObject(e,"currency"),"name",""),[]);if(!BX.type.isNotEmptyString(i[t])){i[t]=BX.Currency.Editor.getBaseCurrencyId()}this._selectedCurrencyValue.push(i[t]);var n=this._model.getField(BX.prop.getString(e,"formattedWithCurrency"),[]);var r=this._model.getField(BX.prop.getString(e,"formatted"),[]);var o=n[t];var s=r[t];var a=BX.Currency.Editor.trimTrailingZeros(s,this._selectedCurrencyValue[t]);return o.replace(s,a)};BX.UI.EntityEditorMultiMoney.prototype.doClearLayout=function(t){BX.PopupMenu.destroy(this._id);for(var e=0;e<this._currencyEditor.length;e++){this._currencyEditor[e].clean()}this._currencyEditor=[];this._select=[];this._selectIcon=[];this._amountValue=[];this._amountInput=[];this._currencyInput=[];this._sumElement=[];this._selectContainer=[];this._inputWrapper=null;this._innerWrapper=null};BX.UI.EntityEditorMultiMoney.prototype.refreshLayout=function(){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorMultiMoney.superclass.refreshLayout.apply(this,arguments);return}var t=this.getValue();if(this._mode===BX.UI.EntityEditorMode.edit&&this._inputContainer){for(var e=0,i=t.length;e<i;e++){this._inputContainer.appendChild(this.createSingleInput(e))}}else if(this._mode===BX.UI.EntityEditorMode.view&&this._innerWrapper){this._innerWrapper.innerHTML="";this._innerWrapper.appendChild(this.getViewInnerLayout())}};BX.UI.EntityEditorMultiMoney.prototype.save=function(){if(!this.isEditable()){return}var t=this._schemeElement.getData();this._model.setField(BX.prop.getString(BX.prop.getObject(t,"currency"),"name"),this._selectedCurrencyValue,{originator:this});if(this._amountValue){var e=[];for(var i=0;i<this._amountValue.length;i++){e.push(this._amountValue[i])}this._model.setField(BX.prop.getString(t,"amount"),e,{originator:this});this._model.setField(BX.prop.getString(t,"formatted"),[],{originator:this})}};BX.UI.EntityEditorMultiMoney.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getAmountFieldName()){return}this.refreshLayout()};BX.UI.EntityEditorMultiMoney.prototype.getRuntimeValue=function(){var t=[];if(this._mode===BX.UI.EntityEditorMode.edit){if(this._amountValue){var e=[];for(var i=0;i<this._amountValue.length;i++){e.push(this._amountValue[i].value)}t[BX.prop.getString(t,"amount")]=e}t[BX.prop.getString(t,"currency")]=this._selectedCurrencyValue;return t}return""};BX.UI.EntityEditorMultiMoney.create=function(t,e){var i=new BX.UI.EntityEditorMultiMoney;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorMultiDatetime==="undefined"){BX.UI.EntityEditorMultiDatetime=function(){BX.UI.EntityEditorMultiDatetime.superclass.constructor.apply(this);this._input=null;this._inputClickHandler=BX.delegate(this.onInputClick,this);this._innerWrapper=null};BX.extend(BX.UI.EntityEditorMultiDatetime,BX.UI.EntityEditorMultiText);BX.UI.EntityEditorMultiDatetime.prototype.isTimeEnabled=function(){return BX.prop.get(this._schemeElement.getData(),"enableTime",true)};BX.UI.EntityEditorMultiDatetime.prototype.onInputClick=function(t){this.showCalendar(t.target)};BX.UI.EntityEditorMultiDatetime.prototype.showCalendar=function(t){if(BX.type.isDomNode(t)){BX.calendar({node:t,field:t,bTime:this.isTimeEnabled(),bSetFocus:false})}};BX.UI.EntityEditorMultiDatetime.prototype.getDateFormat=function(){var t="j F Y";if(this.isTimeEnabled()){t="j F Y H:i"}return BX.prop.getString(this._schemeElement.getData(),"dateViewFormat",t)};BX.UI.EntityEditorMultiDatetime.prototype.getSingleViewItem=function(t){return BX.create("p",{text:BX.date.format(this.getDateFormat(),BX.parseDate(t))})};BX.UI.EntityEditorMultiDatetime.prototype.createSingleInput=function(t){return BX.create("div",{attrs:{className:"ui-ctl ui-ctl-after-icon ui-ctl-datetime field-wrap"},children:[BX.create("div",{attrs:{className:"ui-ctl-after ui-ctl-icon-calendar"}}),BX.create("input",{attrs:{name:this.getName()+"[]",className:"ui-ctl-element",type:"text",value:t||""},events:{input:this._changeHandler,change:this._changeHandler,click:this._inputClickHandler}})]})};BX.UI.EntityEditorMultiDatetime.create=function(t,e){var i=new BX.UI.EntityEditorMultiDatetime;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorMultiNumber==="undefined"){BX.UI.EntityEditorMultiNumber=function(){BX.UI.EntityEditorMultiNumber.superclass.constructor.apply(this);this._input=null;this._innerWrapper=null};BX.extend(BX.UI.EntityEditorMultiNumber,BX.UI.EntityEditorMultiText);BX.UI.EntityEditorMultiNumber.prototype.createSingleInput=function(t){return BX.create("div",{attrs:{className:"ui-ctl ui-ctl-number field-wrap"},children:[BX.create("input",{attrs:{name:this.getName()+"[]",className:"ui-ctl-element",type:"number",value:t||""},events:{input:this._changeHandler}})]})};BX.UI.EntityEditorMultiNumber.create=function(t,e){var i=new BX.UI.EntityEditorMultiNumber;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorTextarea==="undefined"){BX.UI.EntityEditorTextarea=function(){BX.UI.EntityEditorText.superclass.constructor.apply(this);this._input=null;this._innerWrapper=null};BX.extend(BX.UI.EntityEditorTextarea,BX.UI.EntityEditorField);BX.UI.EntityEditorTextarea.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorTextarea.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorTextarea.prototype.focus=function(){if(!this._input){return}BX.focus(this._input);BX.UI.EditorTextHelper.getCurrent().setPositionAtEnd(this._input)};BX.UI.EntityEditorTextarea.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-text"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getName();var i=this.getTitle();var n=this.getValue();this._input=null;this._inputContainer=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(i));this._inputContainer=BX.create("div",{attrs:{className:"ui-ctl ui-ctl-textarea ui-ctl-no-resize ui-ctl-w100"}});this._input=BX.create("textarea",{attrs:{name:e,className:"ui-ctl-element",id:this._id.toLowerCase()+"_text"},children:n});this._inputContainer.appendChild(this._input);if(this.isNewEntity()){var r=this.getCreationPlaceholder();if(r!==""){this._input.setAttribute("placeholder",r)}}BX.bind(this._input,"input",this._changeHandler);this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._inputContainer]})}else{this._wrapper.appendChild(this.createTitleNode(i));if(this.hasContentToDisplay()){this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},html:BX.util.nl2br(BX.util.htmlspecialchars(n))})]})}else{this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},text:BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")})}}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorTextarea.prototype.doClearLayout=function(t){this._input=null;this._innerWrapper=null};BX.UI.EntityEditorTextarea.prototype.refreshLayout=function(){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorTextarea.superclass.refreshLayout.apply(this,arguments);return}if(this._mode===BX.UI.EntityEditorMode.edit&&this._input){this._input.value=this.getValue()}else if(this._mode===BX.UI.EntityEditorMode.view&&this._innerWrapper){this._innerWrapper.innerHTML=BX.util.htmlspecialchars(this.getValue())}};BX.UI.EntityEditorTextarea.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?BX.util.trim(this._input.value):""};BX.UI.EntityEditorTextarea.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._input)){throw"BX.UI.EntityEditorTextarea. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!this.isRequired()||BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return e};BX.UI.EntityEditorTextarea.prototype.showError=function(t,e){BX.UI.EntityEditorTextarea.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorTextarea.prototype.clearError=function(){BX.UI.EntityEditorTextarea.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorTextarea.prototype.save=function(){if(this._input){this._model.setField(this.getName(),this._input.value,{originator:this})}};BX.UI.EntityEditorTextarea.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorTextarea.prototype.getFocusInputID=function(){return this._id.toLowerCase()+"_text"};BX.UI.EntityEditorTextarea.create=function(t,e){var i=new BX.UI.EntityEditorTextarea;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorNumber==="undefined"){BX.UI.EntityEditorNumber=function(){BX.UI.EntityEditorNumber.superclass.constructor.apply(this);this._input=null;this._innerWrapper=null};BX.extend(BX.UI.EntityEditorNumber,BX.UI.EntityEditorField);BX.UI.EntityEditorNumber.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorNumber.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorNumber.prototype.focus=function(){if(!this._input){return}BX.focus(this._input);BX.UI.EditorTextHelper.getCurrent().selectAll(this._input)};BX.UI.EntityEditorNumber.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-content-block-field-number"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getName();var i=this.getTitle();var n=this.getValue();if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}this._input=null;if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(i));this._inputContainer=BX.create("div",{attrs:{className:"ui-ctl ui-ctl-textbox"}});this._input=BX.create("input",{attrs:{name:e,className:"ui-ctl-element",type:"number",value:n,id:this._id.toLowerCase()+"_text"}});this._inputContainer.appendChild(this._input);if(this.isNewEntity()){var r=this.getCreationPlaceholder();if(r!==""){this._input.setAttribute("placeholder",r)}}BX.bind(this._input,"input",this._changeHandler);this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._inputContainer]})}else{this._wrapper.appendChild(this.createTitleNode(i));if(!this.hasContentToDisplay()){n=BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")}this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-number"},text:n})]})}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorNumber.prototype.doClearLayout=function(t){this._input=null;this._innerWrapper=null};BX.UI.EntityEditorNumber.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?BX.util.trim(this._input.value):""};BX.UI.EntityEditorNumber.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._input)){throw"BX.UI.EntityEditorNumber. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return e};BX.UI.EntityEditorNumber.prototype.showError=function(t,e){BX.UI.EntityEditorNumber.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._input,"ui-entity-editor-field-error")}};BX.UI.EntityEditorNumber.prototype.clearError=function(){BX.UI.EntityEditorNumber.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._input,"ui-entity-editor-field-error")}};BX.UI.EntityEditorNumber.prototype.save=function(){if(this._input){this._model.setField(this.getName(),this._input.value)}};BX.UI.EntityEditorNumber.create=function(t,e){var i=new BX.UI.EntityEditorNumber;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorDatetime==="undefined"){BX.UI.EntityEditorDatetime=function(){BX.UI.EntityEditorDatetime.superclass.constructor.apply(this);this._input=null;this._inputClickHandler=BX.delegate(this.onInputClick,this);this._innerWrapper=null};BX.extend(BX.UI.EntityEditorDatetime,BX.UI.EntityEditorField);BX.UI.EntityEditorDatetime.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorDatetime.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorDatetime.prototype.focus=function(){if(this._input){BX.focus(this._input);BX.UI.EditorTextHelper.getCurrent().selectAll(this._input)}};BX.UI.EntityEditorDatetime.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-date"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getName();var i=this.getTitle();var n=this.getValue();this._input=null;this._inputIcon=null;this._innerContainer=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._input=BX.create("input",{attrs:{name:e,className:"ui-ctl-element",type:"text",value:n}});BX.bind(this._input,"click",this._inputClickHandler);BX.bind(this._input,"change",this._changeHandler);BX.bind(this._input,"input",this._changeHandler);this._inputIcon=BX.create("div",{attrs:{className:"ui-ctl-after ui-ctl-icon-calendar"}});this._wrapper.appendChild(this.createTitleNode(i));this._innerContainer=BX.create("div",{props:{className:"ui-ctl ui-ctl-after-icon ui-ctl-datetime ui-ctl-w50"},children:[this._inputIcon,this._input]});this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._innerContainer]})}else{n=BX.date.format(this.getDateFormat(),BX.parseDate(n));this._wrapper.appendChild(this.createTitleNode(i));if(!this.hasContentToDisplay()){n=BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")}this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},text:n.replaceAll("\\","")})]})}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorDatetime.prototype.doRegisterLayout=function(){};BX.UI.EntityEditorDatetime.prototype.doClearLayout=function(t){this._input=null;this._innerWrapper=null};BX.UI.EntityEditorDatetime.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?BX.util.trim(this._input.value):""};BX.UI.EntityEditorDatetime.prototype.isTimeEnabled=function(){return BX.prop.get(this._schemeElement.getData(),"enableTime",true)};BX.UI.EntityEditorDatetime.prototype.onInputClick=function(t){this.showCalendar()};BX.UI.EntityEditorDatetime.prototype.showCalendar=function(){BX.calendar({node:this._input,field:this._input,bTime:this.isTimeEnabled(),bSetFocus:false})};BX.UI.EntityEditorDatetime.prototype.getDateFormat=function(){var t="j F Y";if(this.isTimeEnabled()){t="j F Y H:i"}return BX.prop.getString(this._schemeElement.getData(),"dateViewFormat",t)};BX.UI.EntityEditorDatetime.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._input)){throw"BX.UI.EntityEditorDatetime. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return e};BX.UI.EntityEditorDatetime.prototype.showError=function(t,e){BX.UI.EntityEditorDatetime.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorDatetime.prototype.clearError=function(){BX.UI.EntityEditorDatetime.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorDatetime.prototype.save=function(){if(this._input){this._model.setField(this.getName(),this._input.value)}};BX.UI.EntityEditorDatetime.create=function(t,e){var i=new BX.UI.EntityEditorDatetime;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorBoolean==="undefined"){BX.UI.EntityEditorBoolean=function(){BX.UI.EntityEditorBoolean.superclass.constructor.apply(this);this._input=null;this._innerWrapper=null};BX.extend(BX.UI.EntityEditorBoolean,BX.UI.EntityEditorField);BX.UI.EntityEditorBoolean.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorBoolean.prototype.doInitialize=function(){BX.UI.EntityEditorBoolean.superclass.doInitialize.apply(this);this._selectedValue=this._model.getField(this._schemeElement.getName())};BX.UI.EntityEditorBoolean.prototype.areAttributesEnabled=function(){return false};BX.UI.EntityEditorBoolean.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorBoolean.prototype.hasValue=function(){return BX.util.trim(this.getValue())!==""};BX.UI.EntityEditorBoolean.prototype.getValue=function(t){if(!this._model){return""}if(t===undefined){t="N"}var e=this._model.getStringField(this.getName(),t);if(e!==this.getCheckedValue()&&e!=="N"){e="N"}return e};BX.UI.EntityEditorBoolean.prototype.getRuntimeValue=function(){if(this._mode!==BX.UI.EntityEditorMode.edit||!this._input)return"";var t=BX.util.trim(this._input.value);if(t!=="Y"&&t!=="N"){t="N"}return t};BX.UI.EntityEditorBoolean.prototype.getCheckedValue=function(){return this._schemeElement.getDataParam("value","Y")};BX.UI.EntityEditorBoolean.prototype.isChecked=function(){return this.getValue()===this.getCheckedValue()};BX.UI.EntityEditorBoolean.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-checkbox"]});this.adjustWrapper();var e=this.getName();var i=this.getTitle();var n=this.getValue();this._input=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(BX.create("input",{attrs:{name:e,type:"hidden",value:"N"}}));this._input=BX.create("input",{attrs:{className:"ui-ctl-element",name:e,type:"checkbox",value:this.getCheckedValue(),checked:this.isChecked()}});BX.bind(this._input,"change",this._changeHandler);this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("label",{props:{className:"ui-ctl ui-ctl-xs ui-ctl-w100 ui-ctl-checkbox"},children:[this._input,BX.create("div",{attrs:{className:"ui-ctl-label-text"},text:i})]})]})}else{this._wrapper.appendChild(this.createTitleNode(i));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},text:BX.message(this.isChecked()?"UI_ENTITY_EDITOR_YES":"UI_ENTITY_EDITOR_NO")})]})}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorBoolean.prototype.doClearLayout=function(t){this._input=null;this._innerWrapper=null};BX.UI.EntityEditorBoolean.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._input)){throw"BX.UI.EntityEditorBoolean. Invalid validation context"}if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));BX.addClass(this._inputContainer,"ui-ctl-danger");this.showRequiredFieldError(this._input)}else{BX.removeClass(this._input,"ui-ctl-danger");this.clearError()}return e};BX.UI.EntityEditorBoolean.prototype.showError=function(t,e){BX.UI.EntityEditorBoolean.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._inputContainer,"ui-ctl-danger")}};BX.UI.EntityEditorBoolean.prototype.clearError=function(){BX.UI.EntityEditorBoolean.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._input,"ui-ctl-danger")}};BX.UI.EntityEditorBoolean.prototype.save=function(){if(this._input){this._model.setField(this.getName(),this._input.checked?"Y":"N",{originator:this})}};BX.UI.EntityEditorBoolean.create=function(t,e){var i=new BX.UI.EntityEditorBoolean;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorList==="undefined"){BX.UI.EntityEditorList=function(){BX.UI.EntityEditorList.superclass.constructor.apply(this);this._items=null;this._input=null;this._select=null;this._selectContainer=null;this._selectedValue="";this._selectorClickHandler=BX.delegate(this.onSelectorClick,this);this._innerWrapper=null;this._isOpened=false};BX.extend(BX.UI.EntityEditorList,BX.UI.EntityEditorField);BX.UI.EntityEditorList.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorList.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorList.prototype.checkIfNotEmpty=function(t){return t!==""&&t!=="0"};BX.UI.EntityEditorList.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-select"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getName();var i=this.getTitle();var n=this.getValue();var r=this.getItemByValue(n);var o=this.getDataBooleanParam("isHtml",false);var s={};if(!r){r=this.getFirstItem();if(r){n=r["VALUE"]}}this._selectedValue=n;this._select=null;this._selectIcon=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(i));this._input=BX.create("input",{attrs:{name:e,type:"hidden",value:n}});this._wrapper.appendChild(this._input);s={props:{className:"ui-ctl-element"}};if(o){s.html=r?r["NAME"]:n}else{s.text=r?r["NAME"]:n}this._select=BX.create("div",s);BX.bind(this._select,"click",this._selectorClickHandler);this._selectIcon=BX.create("div",{attrs:{className:"ui-ctl-after ui-ctl-icon-angle"}});this._selectContainer=BX.create("div",{props:{className:"ui-ctl ui-ctl-after-icon ui-ctl-dropdown ui-ctl-w100"},children:[this._select,this._selectIcon]});this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._selectContainer]})}else{this._wrapper.appendChild(this.createTitleNode(i));var a="";if(!this.hasContentToDisplay()){a=BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")}else if(r){a=r["NAME"]}else{a=n}s={props:{className:"ui-entity-editor-content-block-text"}};if(o){s.html=a}else{s.text=a}this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",s)]})}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorList.prototype.doRegisterLayout=function(){};BX.UI.EntityEditorList.prototype.doClearLayout=function(t){this.closeMenu();this._input=null;this._select=null;this._innerWrapper=null};BX.UI.EntityEditorList.prototype.refreshLayout=function(){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorList.superclass.refreshLayout.apply(this,arguments);return}var t=this.getValue();var e=this.getItemByValue(t);var i=e?BX.prop.getString(e,"NAME",t):t;if(this._mode===BX.UI.EntityEditorMode.edit){this._selectedValue=t;if(this._input){this._input.value=t}if(this._select){this._select.innerHTML=this.getDataBooleanParam("isHtml",false)?i:BX.util.htmlspecialchars(i)}}else if(this._mode===BX.UI.EntityEditorMode.view&&this._innerWrapper){this._innerWrapper.innerHTML=this.getDataBooleanParam("isHtml",false)?i:BX.util.htmlspecialchars(i)}};BX.UI.EntityEditorList.prototype.validate=function(t){if(this._mode!==BX.UI.EntityEditorMode.edit){throw"BX.UI.EntityEditorList. Invalid validation context"}if(!this.isEditable()){return true}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||this._input&&BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return e};BX.UI.EntityEditorList.prototype.showError=function(t,e){BX.UI.EntityEditorList.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._selectContainer,"ui-ctl-danger")}};BX.UI.EntityEditorList.prototype.clearError=function(){BX.UI.EntityEditorList.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._selectContainer,"ui-ctl-danger")}};BX.UI.EntityEditorList.prototype.onSelectorClick=function(t){if(!this._isOpened){this.openMenu()}else{this.closeMenu()}};BX.UI.EntityEditorList.prototype.openMenu=function(){if(this._isOpened){return}var t=[];var e=this.getItems();for(var i=0,n=e.length;i<n;i++){var r=e[i];if(!BX.prop.getBoolean(r,"IS_EDITABLE",true)){continue}var o=BX.prop.getString(r,"VALUE",i);var s=BX.prop.getString(r,"NAME",o);var a={value:o,onclick:BX.delegate(this.onItemSelect,this)};if(this.getDataBooleanParam("isHtml",false)){a["html"]=s}else{a["text"]=s}t.push(a)}const l=BX.Dom.getPosition(this._select).y;const d=l-window.pageYOffset;const h=document.documentElement.clientHeight+window.pageYOffset-l;const u=d>h?d-50:h-100;BX.PopupMenu.show(this._id,this._select,t,{angle:false,width:this._select.offsetWidth+"px",maxHeight:u,events:{onPopupShow:BX.delegate(this.onMenuShow,this),onPopupClose:BX.delegate(this.onMenuClose,this)}});BX.PopupMenu.currentItem.popupWindow.setWidth(BX.pos(this._select)["width"])};BX.UI.EntityEditorList.prototype.closeMenu=function(){var t=BX.PopupMenu.getMenuById(this._id);if(t){t.popupWindow.close()}};BX.UI.EntityEditorList.prototype.onMenuShow=function(){BX.addClass(this._selectContainer,"ui-ctl-active");this._isOpened=true};BX.UI.EntityEditorList.prototype.onMenuClose=function(){BX.PopupMenu.destroy(this._id);BX.removeClass(this._selectContainer,"ui-ctl-active");this._isOpened=false};BX.UI.EntityEditorList.prototype.onItemSelect=function(t,e){this.closeMenu();var i={field:this,item:e,cancel:false};BX.onCustomEvent(window,"BX.UI.EntityEditorList:onItemSelect",[this,i]);if(i["cancel"]){return}this._selectedValue=this._input.value=e.value;var n=BX.prop.getString(this.getItemByValue(this._selectedValue),"NAME",this._selectedValue);this._select.innerHTML=this.getDataBooleanParam("isHtml",false)?n:BX.util.htmlspecialchars(n);this.markAsChanged();BX.PopupMenu.destroy(this._id)};BX.UI.EntityEditorList.prototype.setItems=function(t){if(!BX.type.isArray(t)){t=BX.prop.getArray(this._schemeElement.getData(),"items",[])}if(!this.isRequired()&&BX.prop.get(this._schemeElement.getData(),"enableEmptyItem",false)){var e=t.filter((function(t){return t.VALUE===""}));if(e.length===0){t.unshift({VALUE:"",NAME:BX.message("UI_ENTITY_EDITOR_NOT_SELECTED")})}}this._items=t};BX.UI.EntityEditorList.prototype.getItems=function(){if(!this._items){this.setItems()}return this._items};BX.UI.EntityEditorList.prototype.getItemByValue=function(t){t=t||"";t=t.toString();var e=this.getItems();for(var i=0,n=e.length;i<n;i++){var r=e[i];if(t===BX.prop.getString(r,"VALUE","")){return r}}return null};BX.UI.EntityEditorList.prototype.getFirstItem=function(){var t=this.getItems();return t.length>0?t[0]:null};BX.UI.EntityEditorList.prototype.save=function(){if(!this.isEditable()){return}this._model.setField(this.getName(),this._selectedValue)};BX.UI.EntityEditorList.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorList.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?this._selectedValue:""};BX.UI.EntityEditorList.create=function(t,e){var i=new BX.UI.EntityEditorList;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorMultiList==="undefined"){BX.UI.EntityEditorMultiList=function(){BX.UI.EntityEditorMultiList.superclass.constructor.apply(this);this._items=null;this._selector=null;this._selectedValues=[];this._hiddenNode="";this._selectorClickHandler=BX.delegate(this.onSelectorClick,this);this._innerWrapper=null;this._isOpened=false};BX.extend(BX.UI.EntityEditorMultiList,BX.UI.EntityEditorField);BX.UI.EntityEditorMultiList.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorMultiList.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorMultiList.prototype.hasContentToDisplay=function(){var t=this.getValue();this.getItems();if(!BX.type.isArray(t)||t.length===0){return false}var e=this._items.filter((function(e){return BX.util.in_array(e.VALUE,t)}));return e.length>0};BX.UI.EntityEditorMultiList.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-multiselect"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getId();var i=this.getTitle();var n=this.getValue();this._selectedValues=this.getSelectedValues(n);if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(i));var r={isMulti:true,fieldName:e};if(!this._selector){this._selector=BX.decl({block:"main-ui-multi-select",name:e,items:this._items,value:this._selectedValues,params:r,valueDelete:true})}var o=BX.create("div",{props:{className:"fields enumeration field-item"},children:[this._selector]});BX.addCustomEvent(window,"UI::Select::change",BX.delegate(this.onChange,this));BX.bind(o,"click",BX.defer((function(){this.onChange({params:r,node:o.firstChild})}),this));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"}});this._innerWrapper.appendChild(o);this.layoutHidden();this._innerWrapper.appendChild(this._hiddenNode)}else{this._wrapper.appendChild(this.createTitleNode(i));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"}});if(!this.hasContentToDisplay()){this._innerWrapper.appendChild(BX.create("div",{text:this.getMessage("isEmpty")}))}else{var s=[];for(var a=0;a<this._selectedValues.length;a++){var l=this.getItemByValue(this._selectedValues[a].VALUE);var d;if(BX.type.isNotEmptyString(l["HTML"])){d=l["HTML"]}else if(BX.type.isNotEmptyString(l["NAME"])){d=BX.util.htmlspecialchars(l["NAME"])}else{d=BX.util.htmlspecialchars(l["VALUE"])}s.push(d)}if(s.length>0){this._innerWrapper.appendChild(BX.create("div",{props:{className:"ui-entity-editor-content-block"},html:s.join(", ")}))}}}this._wrapper.appendChild(this._innerWrapper);if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorMultiList.prototype.doClearLayout=function(t){this._selector=null;this._innerWrapper=null};BX.UI.EntityEditorMultiList.prototype.layoutHidden=function(){if(!BX.type.isDomNode(this._hiddenNode)){this._hiddenNode=BX.create("div")}else{this._hiddenNode.innerHTML=""}var t=this._selectedValues.length;if(t>0){for(var e=0;e<t;e++){this._hiddenNode.appendChild(BX.create("input",{attrs:{type:"hidden",name:this.getName()+"[]",value:this._selectedValues[e].VALUE}}))}}else{this._hiddenNode.appendChild(BX.create("input",{attrs:{type:"hidden",name:this.getName()+"[]"}}))}};BX.UI.EntityEditorMultiList.prototype.validate=function(t){if(this._mode!==BX.UI.EntityEditorMode.edit){throw"BX.UI.EntityEditorMultiList. Invalid validation context"}if(!this.isEditable()){return true}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!this.isRequired()||this._selectedValues.length>0;if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._selector)}return e};BX.UI.EntityEditorMultiList.prototype.showError=function(t,e){BX.UI.EntityEditorMultiList.superclass.showError.apply(this,arguments);if(this._selector){BX.addClass(this._selector,"ui-entity-editor-field-error")}};BX.UI.EntityEditorMultiList.prototype.clearError=function(){BX.UI.EntityEditorMultiList.superclass.clearError.apply(this);if(this._selector){BX.removeClass(this._selector,"ui-entity-editor-field-error")}};BX.UI.EntityEditorMultiList.prototype.onChange=function(t){if(t.params.fieldName===this.getName()&&this._selector){this._selectedValues=JSON.parse(this._selector.getAttribute("data-value"));this.layoutHidden();this.markAsChanged()}};BX.UI.EntityEditorMultiList.prototype.getItems=function(){if(!this._items){this._items=BX.prop.getArray(this._schemeElement.getData(),"items",[])}return this._items};BX.UI.EntityEditorMultiList.prototype.getItemByValue=function(t){var e=this.getItems();for(var i=0,n=e.length;i<n;i++){var r=e[i];if(t===BX.prop.getString(r,"VALUE","")){return r}}return null};BX.UI.EntityEditorMultiList.prototype.getSelectedValues=function(t){var e=[];var i=this.getItems();if(!BX.type.isArray(t)){return[]}for(var n=0;n<t.length;n++){value=""+t[n];for(var r=0,o=i.length;r<o;r++){var s=i[r];if(value===BX.prop.getString(s,"VALUE","")){e.push(s)}}}return e};BX.UI.EntityEditorMultiList.prototype.getFirstItem=function(){var t=this.getItems();return t.length>0?t[0]:null};BX.UI.EntityEditorMultiList.prototype.save=function(){if(!this.isEditable()){return}this._model.setField(this.getName(),this.getRuntimeValue())};BX.UI.EntityEditorMultiList.prototype.getRuntimeValue=function(){var t=[];if(this._mode===BX.UI.EntityEditorMode.edit&&this._selector){for(var e=0;e<this._selectedValues.length;e++){t.push(this._selectedValues[e].VALUE)}}return t};BX.UI.EntityEditorMultiList.prototype.setItems=function(t){if(!BX.type.isArray(t)){t=BX.prop.getArray(this._schemeElement.getData(),"items",[])}this._items=t};BX.UI.EntityEditorMultiList.create=function(t,e){var i=new BX.UI.EntityEditorMultiList;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorHtml==="undefined"){BX.UI.EntityEditorHtml=function(){BX.UI.EntityEditorHtml.superclass.constructor.apply(this);this._htmlEditorContainer=null;this._htmlEditor=null;this._isEditorInitialized=false;this._focusOnLoad=false;this._input=null;this._innerWrapper=null;this._editorInitializationHandler=BX.delegate(this.onEditorInitialized,this);this._viewClickHandler=BX.delegate(this.onViewClick,this)};BX.extend(BX.UI.EntityEditorHtml,BX.UI.EntityEditorField);BX.UI.EntityEditorHtml.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorHtml.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorHtml.prototype.checkIfNotEmpty=function(t){return BX.UI.EntityEditorHtml.isNotEmptyValue(t)};BX.UI.EntityEditorHtml.prototype.focus=function(){if(this._htmlEditor&&this._isEditorInitialized){this._htmlEditor.Focus(true)}else{this._focusOnLoad=true}};BX.UI.EntityEditorHtml.prototype.layout=function(t){if(this._hasLayout){return}this.release();this.ensureWrapperCreated({classNames:["ui-entity-editor-content-block-field-html"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getName();var i=this.getTitle();var n=this.getValue();this._input=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){if(!this._editor){throw"BX.UI.EntityEditorHtml: Editor instance is required for create layout."}var r=this._editor.getHtmlEditorConfig(e);if(!r){throw"BX.UI.EntityEditorHtml: Could not find HTML editor config."}this._htmlEditorContainer=BX(BX.prop.getString(r,"containerId"));if(!BX.type.isElementNode(this._htmlEditorContainer)){throw"BX.UI.EntityEditorHtml: Could not find HTML editor container."}this._htmlEditor=BXHtmlEditor.Get(BX.prop.getString(r,"id"));if(!this._htmlEditor){throw"BX.UI.EntityEditorHtml: Could not find HTML editor instance."}this._wrapper.appendChild(this.createTitleNode(i));this._input=BX.create("input",{attrs:{name:e,type:"hidden",value:n}});this._wrapper.appendChild(this._input);this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-field-container"},children:[this._htmlEditorContainer]})]})}else{this._wrapper.appendChild(this.createTitleNode(i));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"}});if(this.hasContentToDisplay()){var o=BX.create("div",{props:{className:"ui-entity-editor-content-block-inner-html"},html:n});this._innerWrapper.appendChild(BX.create("div",{props:{className:"ui-entity-editor-content-block-field-container"},children:[o]}));var s=o&&o.innerText&&o.innerText.length;if(s>200){BX.addClass(this._wrapper,"ui-entity-editor-content-block-field-html-collapsed");this._innerWrapper.appendChild(BX.create("DIV",{attrs:{className:"ui-entity-editor-content-block-field-html-expand-btn-container"},children:[BX.create("A",{attrs:{className:"ui-entity-editor-content-block-field-html-expand-btn",href:"#"},events:{click:BX.delegate(this.onExpandButtonClick,this)},text:BX.message("UI_ENTITY_EDITOR_EXPAND_HTML")})]}));this._isCollapsed=true}}else{this._innerWrapper.appendChild(document.createTextNode(BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")))}this._wrapper.appendChild(this._innerWrapper);BX.bindDelegate(this._wrapper,"mousedown",BX.delegate(this.filterViewNode,this),this._viewClickHandler)}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);if(this._mode===BX.UI.EntityEditorMode.edit){this._isEditorInitialized=!!this._htmlEditor.inited;if(this._isEditorInitialized){this.prepareEditor()}else{BX.addCustomEvent(this._htmlEditor,"OnCreateIframeAfter",this._editorInitializationHandler);setTimeout(function(){this._htmlEditor.Init()}.bind(this),0)}window.top.setTimeout(BX.delegate(this.bindChangeEvent,this),1e3);this.initializeDragDropAbilities()}this._hasLayout=true};BX.UI.EntityEditorHtml.prototype.doClearLayout=function(t){this.release();this._input=null;this._innerWrapper=null};BX.UI.EntityEditorHtml.prototype.onExpandButtonClick=function(t){if(!this._wrapper){return BX.PreventDefault(t)}if(this._hasFiles&&BX.type.isDomNode(this._commentWrapper)&&!this._textLoaded){this._textLoaded=true;this.loadContent(this._commentWrapper,"GET_TEXT")}var e=this._wrapper.querySelector(".ui-entity-editor-content-block-inner-html");if(this._isCollapsed){BX.defer((function(){e.style.height=e.scrollHeight+20+"px";e.style.maxHeight=e.scrollHeight+130+"px"}))();setTimeout(BX.delegate((function(){BX.removeClass(this._wrapper,"ui-entity-editor-content-block-field-html-collapsed");BX.addClass(this._wrapper,"ui-entity-editor-content-block-field-html-expand");e.style.maxHeight=""}),this),200)}else{BX.defer((function(){e.style.maxHeight=e.clientHeight+"px"}))();BX.defer((function(){BX.removeClass(this._wrapper,"ui-entity-editor-content-block-field-html-expand");BX.addClass(this._wrapper,"ui-entity-editor-content-block-field-html-collapsed")}),this)();setTimeout((function(){e.style.maxHeight=""}),200)}this._isCollapsed=!this._isCollapsed;var i=this._wrapper.querySelector("a.ui-entity-editor-content-block-field-html-expand-btn");if(i){i.innerHTML=BX.message(this._isCollapsed?"UI_ENTITY_EDITOR_EXPAND_HTML":"UI_ENTITY_EDITOR_COLLAPSE_HTML")}return BX.PreventDefault(t)};BX.UI.EntityEditorHtml.prototype.filterViewNode=function(t){return true};BX.UI.EntityEditorHtml.prototype.onViewClick=function(t){var e=null;var i=BX.getEventTarget(t);if(i.tagName==="A"){e=i}else{e=BX.findParent(i,{tagName:"a"},this._wrapper)}if(e&&e.target!=="_blank"){e.target="_blank"}};BX.UI.EntityEditorHtml.prototype.onEditorInitialized=function(){this._isEditorInitialized=true;BX.removeCustomEvent(this._htmlEditor,"OnCreateIframeAfter",this._editorInitializationHandler);this.prepareEditor()};BX.UI.EntityEditorHtml.prototype.prepareEditor=function(){this._htmlEditorContainer.style.display="";setTimeout(function(){this._htmlEditor.CheckAndReInit();this._htmlEditor.ResizeSceleton("100%",200);this._htmlEditor.SetContent(this.getStringValue(""),true);if(this._focusOnLoad){this._htmlEditor.Focus(true);this._focusOnLoad=false}}.bind(this),0)};BX.UI.EntityEditorHtml.prototype.release=function(){if(this._htmlEditorContainer){var t=BX.create("DIV",{style:{height:this._htmlEditorContainer.offsetHeight+"px",border:"1px solid #bbc4cd",boxSizing:"border-box"}});this._htmlEditorContainer.parentNode.insertBefore(t,this._htmlEditorContainer);document.body.appendChild(this._htmlEditorContainer);this._htmlEditorContainer.style.display="none";this._htmlEditorContainer=null}if(this._htmlEditor){this.unbindChangeEvent();this._htmlEditor.SetContent("");this._htmlEditor=null;this._isEditorInitialized=false}this._focusOnLoad=false};BX.UI.EntityEditorHtml.prototype.bindChangeEvent=function(){if(this._htmlEditor){BX.addCustomEvent(this._htmlEditor,"OnContentChanged",this._changeHandler)}};BX.UI.EntityEditorHtml.prototype.unbindChangeEvent=function(){if(this._htmlEditor){BX.removeCustomEvent(this._htmlEditor,"OnContentChanged",this._changeHandler)}};BX.UI.EntityEditorHtml.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._htmlEditor)){throw"BX.UI.EntityEditorHtml. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||BX.UI.EntityEditorHtml.isNotEmptyValue(this._htmlEditor.GetContent());if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._htmlEditorContainer)}return e};BX.UI.EntityEditorHtml.prototype.showError=function(t,e){BX.UI.EntityEditorHtml.superclass.showError.apply(this,arguments);if(this._htmlEditorContainer){BX.addClass(this._htmlEditorContainer,"ui-entity-editor-content-error")}};BX.UI.EntityEditorHtml.prototype.clearError=function(){BX.UI.EntityEditorHtml.superclass.clearError.apply(this);if(this._htmlEditorContainer){BX.removeClass(this._htmlEditorContainer,"ui-entity-editor-content-error")}};BX.UI.EntityEditorHtml.prototype.save=function(){if(this._htmlEditor){var t=this._input.value=this._htmlEditor.GetContent();this._model.setField(this.getName(),t)}};BX.UI.EntityEditorHtml.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?this._htmlEditor.GetContent():""};BX.UI.EntityEditorHtml.isNotEmptyValue=function(t){if(BX.type.isNotEmptyString(t)){return BX.util.trim(t.replace(/<br\/?>|&nbsp;/gi,""))!==""}return false};BX.UI.EntityEditorHtml.create=function(t,e){var i=new BX.UI.EntityEditorHtml;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorBB==="undefined"){BX.UI.EntityEditorBB=function(){BX.UI.EntityEditorBB.superclass.constructor.apply(this)};BX.extend(BX.UI.EntityEditorBB,BX.UI.EntityEditorHtml);BX.UI.EntityEditorBB.prototype.layout=function(t){if(this._hasLayout){return}BX.UI.EntityEditorBB.superclass.layout.apply(this,[t]);if(this._mode!==BX.UI.EntityEditorMode.edit){let t=null;if(this._innerWrapper){t=this._innerWrapper.querySelector(".ui-entity-editor-content-block-inner-html")}if(t){let e=this._model.getField(this.getDataKey()+"_HTML","");if(!BX.Type.isStringFilled(e)){e=BX.Text.encode(this.getValue())}t.innerHTML=e}}};BX.UI.EntityEditorBB.create=function(t,e){var i=new BX.UI.EntityEditorBB;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorFile==="undefined"){BX.UI.EntityEditorFile=function(){BX.UI.EntityEditorFile.superclass.constructor.apply(this);this._innerWrapper=null;this._dialogShowHandler=BX.delegate(this.onDialogShow,this);this._dialogCloseHandler=BX.delegate(this.onDialogClose,this);this._fileChangeHandler=BX.delegate(this.onFileChange,this);this._fileAddHandler=BX.delegate(this.onFileAdd,this);this._fileDeleteHandler=BX.delegate(this.onFileDelete,this)};BX.extend(BX.UI.EntityEditorFile,BX.UI.EntityEditorField);BX.UI.EntityEditorFile.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorFile.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorFile.prototype.hasContentToDisplay=function(){return this._mode===BX.UI.EntityEditorMode.edit||this.getValue().length>0};BX.UI.EntityEditorFile.prototype.loadInput=function(){this._editor.loadCustomHtml("RENDER_IMAGE_INPUT",{FIELD_NAME:this.getDataKey(),ALLOW_UPLOAD:this._mode===BX.UI.EntityEditorMode.edit?"Y":"N"},BX.delegate(this.onEditorHtmlLoad,this))};BX.UI.EntityEditorFile.prototype.onEditorHtmlLoad=function(t){if(this._innerWrapper){this._innerWrapper.innerHTML=t;BX.addCustomEvent(window,"onAfterPopupShow",this._dialogShowHandler);BX.addCustomEvent(window,"onPopupClose",this._dialogCloseHandler);if(this._mode!==BX.UI.EntityEditorMode.edit){this._innerWrapper.querySelectorAll("del").forEach((function(t){t.remove()}))}window.setTimeout(BX.delegate(this.bindFileEvents,this),500)}};BX.UI.EntityEditorFile.prototype.layoutViewMode=function(){var t=this.getTitle();this._wrapper.appendChild(this.createTitleNode(t));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"}});if(this.hasContentToDisplay()){this.loadInput()}else{this._innerWrapper.appendChild(document.createTextNode(this.getMessage("isEmpty")))}};BX.UI.EntityEditorFile.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-widget-content-block-field-file"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getTitle();this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(e));this._innerWrapper=BX.create("div",{props:{className:"crm-entity-widget-content-block-inner"}});this.loadInput()}else{this.layoutViewMode()}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorFile.prototype.doClearLayout=function(t){if(this._innerWrapper){BX.removeCustomEvent(window,"onAfterPopupShow",this._dialogShowHandler);BX.removeCustomEvent(window,"onPopupClose",this._dialogCloseHandler);BX.cleanNode(this._innerWrapper);this._innerWrapper=null}this.unbindFileEvents()};BX.UI.EntityEditorFile.prototype.validate=function(t){var e=0;var i=BX.MFInput?BX.MFInput.get(this.getName().toLowerCase()+"_uploader"):null;if(i){e=i.agent.getItems().length}var n=!(this.isRequired()||this.isRequiredByAttribute())||e>0;if(!n){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return n};BX.UI.EntityEditorFile.prototype.bindFileEvents=function(){var t=BX.MFInput?BX.MFInput.get(this.getName().toLowerCase()+"_uploader"):null;if(t){BX.addCustomEvent(t,"onAddFile",this._fileAddHandler);BX.addCustomEvent(t,"onDeleteFile",this._fileDeleteHandler)}};BX.UI.EntityEditorFile.prototype.unbindFileEvents=function(){var t=BX.MFInput?BX.MFInput.get(this.getName().toLowerCase()+"_uploader"):null;if(t){BX.removeCustomEvent(t,"onAddFile",this._fileAddHandler);BX.removeCustomEvent(t,"onDeleteFile",this._fileDeleteHandler)}};BX.UI.EntityEditorFile.prototype.onDialogShow=function(t){if(t.uniquePopupId.indexOf("popupavatarEditor")!==0){return}BX.addCustomEvent(window,"onApply",this._fileChangeHandler);if(this._singleEditController){this._singleEditController.setActiveDelayed(false)}BX.bind(t.popupContainer,"click",(function(t){BX.eventCancelBubble(t)}))};BX.UI.EntityEditorFile.prototype.onDialogClose=function(t){if(BX.prop.getString(t,"uniquePopupId","").indexOf("popupavatarEditor")!==0){return}BX.removeCustomEvent(window,"onApply",this._fileChangeHandler);if(this._singleEditController){this._singleEditController.setActiveDelayed(true)}};BX.UI.EntityEditorFile.prototype.getValueAsArray=function(){var t=this.getValue();if(!Array.isArray(t)){if(t){t=[t]}else{t=[]}}return t};BX.UI.EntityEditorFile.prototype.onFileChange=function(t){this.markAsChanged()};BX.UI.EntityEditorFile.prototype.onFileAdd=function(t){var e=this.getValueAsArray();e.push(t);this._model.setField(this.getName(),e);this.markAsChanged()};BX.UI.EntityEditorFile.prototype.onFileDelete=function(t){var e=this.getValueAsArray();this._model.setField(this.getName(),e);this.markAsChanged()};BX.UI.EntityEditorFile.create=function(t,e){var i=new BX.UI.EntityEditorFile;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorImage==="undefined"){BX.UI.EntityEditorImage=function(){BX.UI.EntityEditorImage.superclass.constructor.apply(this)};BX.extend(BX.UI.EntityEditorImage,BX.UI.EntityEditorFile);BX.UI.EntityEditorImage.prototype.bindFileEvents=function(){var t=BX.MFInput?BX.MFInput.get(this.getName().toLowerCase()+"_uploader"):null;if(t){BX.addCustomEvent(t,"onAddFile",this._fileChangeHandler);BX.addCustomEvent(t,"onDeleteFile",this._fileChangeHandler)}};BX.UI.EntityEditorImage.prototype.unbindFileEvents=function(){var t=BX.MFInput?BX.MFInput.get(this.getName().toLowerCase()+"_uploader"):null;if(t){BX.removeCustomEvent(t,"onAddFile",this._fileChangeHandler);BX.removeCustomEvent(t,"onDeleteFile",this._fileChangeHandler)}};BX.UI.EntityEditorImage.prototype.hasContentToDisplay=function(){return this._mode===BX.UI.EntityEditorMode.edit||this._model.getSchemeField(this._schemeElement,"showUrl","")!==""};BX.UI.EntityEditorImage.prototype.layoutViewMode=function(){var t=this.getTitle();this._wrapper.appendChild(this.createTitleNode(t));this._innerWrapper=BX.create("div",{props:{className:"crm-entity-widget-content-block-inner"}});if(this.hasContentToDisplay()){this._innerWrapper.appendChild(BX.create("div",{props:{className:"crm-entity-widget-content-block-inner-box"},children:[BX.create("img",{props:{className:"crm-entity-widget-content-block-photo",src:encodeURI(this._model.getSchemeField(this._schemeElement,"showUrl",""))}})]}))}else{this._innerWrapper.appendChild(document.createTextNode(this.getMessage("isEmpty")))}};BX.UI.EntityEditorImage.prototype.loadInput=function(){console.error("loadInput is not implemented")};BX.UI.EntityEditorImage.create=function(t,e){var i=new BX.UI.EntityEditorImage;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorLink==="undefined"){BX.UI.EntityEditorLink=function(){BX.UI.EntityEditorLink.superclass.constructor.apply(this);this._input=null;this._innerWrapper=null;this._link_template="";this._link_target=""};BX.extend(BX.UI.EntityEditorLink,BX.UI.EntityEditorField);BX.UI.EntityEditorLink.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorLink.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorLink.prototype.focus=function(){if(!this._input){return}BX.focus(this._input);BX.UI.EditorTextHelper.getCurrent().setPositionAtEnd(this._input)};BX.UI.EntityEditorLink.prototype.getLineCount=function(){return this._schemeElement.getDataIntegerParam("lineCount",1)};BX.UI.EntityEditorLink.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:["ui-entity-editor-field-text"]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getName();var i=this.getTitle();var n=this.getValue();var r=this.getLinkTemplate();var o=this.getLinkTarget();this._input=null;this._inputContainer=null;this._innerWrapper=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(i));var s=this.getLineCount();if(s>1){this._input=BX.create("textarea",{props:{className:"ui-entity-editor-field-textarea",name:e,rows:s,value:n}})}else{this._inputContainer=BX.create("div",{attrs:{className:"ui-ctl ui-ctl-textbox ui-ctl-w100"}});this._input=BX.create("input",{attrs:{name:e,className:"ui-ctl-element",type:"text",value:n,id:this._id.toLowerCase()+"_text"}});this._inputContainer.appendChild(this._input)}if(this.isNewEntity()){var a=this.getCreationPlaceholder();if(a!==""){this._input.setAttribute("placeholder",a)}}BX.bind(this._input,"input",this._changeHandler);this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._inputContainer]})}else{this._wrapper.appendChild(this.createTitleNode(i));if(this.hasContentToDisplay()){this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("a",{props:{className:"ui-entity-editor-content-block-text",href:r.replace("#LINK#",n),target:o},text:n})]})}else{this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},text:BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")})}}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorLink.prototype.doClearLayout=function(t){this._input=null;this._innerWrapper=null};BX.UI.EntityEditorLink.prototype.refreshLayout=function(){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorLink.superclass.refreshLayout.apply(this,arguments);return}if(this._mode===BX.UI.EntityEditorMode.edit&&this._input){this._input.value=this.getValue()}else if(this._mode===BX.UI.EntityEditorMode.view&&this._innerWrapper){this._innerWrapper.innerHTML=BX.util.htmlspecialchars(this.getValue())}};BX.UI.EntityEditorLink.prototype.getLinkTemplate=function(){if(!this._link_template){this._link_template=BX.prop.get(this._schemeElement.getData(),"link_template","#LINK#")}return this._link_template};BX.UI.EntityEditorLink.prototype.getLinkTarget=function(){if(!this._link_target){this._link_target=BX.prop.get(this._schemeElement.getData(),"target","")}return this._link_target};BX.UI.EntityEditorLink.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit&&this._input?BX.util.trim(this._input.value):""};BX.UI.EntityEditorLink.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._input)){throw"BX.UI.EntityEditorLink. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!this.isRequired()||BX.util.trim(this._input.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._input)}return e};BX.UI.EntityEditorLink.prototype.showError=function(t,e){BX.UI.EntityEditorLink.superclass.showError.apply(this,arguments);if(this._input){BX.addClass(this._input,"ui-entity-editor-field-error")}};BX.UI.EntityEditorLink.prototype.clearError=function(){BX.UI.EntityEditorLink.superclass.clearError.apply(this);if(this._input){BX.removeClass(this._input,"ui-entity-editor-field-error")}};BX.UI.EntityEditorLink.prototype.save=function(){if(this._input){this._model.setField(this.getName(),this._input.value,{originator:this})}};BX.UI.EntityEditorLink.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorLink.prototype.getFocusInputID=function(){return this._id.toLowerCase()+"_text"};BX.UI.EntityEditorLink.create=function(t,e){var i=new BX.UI.EntityEditorLink;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorCustom==="undefined"){BX.UI.EntityEditorCustom=function(){BX.UI.EntityEditorCustom.superclass.constructor.apply(this);this._innerWrapper=null;this._runtimeValue=null};BX.extend(BX.UI.EntityEditorCustom,BX.UI.EntityEditorField);BX.UI.EntityEditorCustom.prototype.initialize=function(t,e){BX.UI.EntityEditorCustom.superclass.initialize.call(this,t,e);if(this._schemeElement&&this._schemeElement.getDataParam("type")==="LOCATION"&&this._model&&this._model.getField(t)){this.setRuntimeValue(this._model.getField(t))}};BX.UI.EntityEditorCustom.prototype.hasContentToDisplay=function(){return this.getHtmlContent()!==""};BX.UI.EntityEditorCustom.prototype.doClearLayout=function(t){this.setRuntimeValue(this.getValue())};BX.UI.EntityEditorCustom.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorCustom.prototype.areModelValuesEqual=function(t,e){var i=t.getSchemeField(this._schemeElement,"view","");var n=e.getSchemeField(this._schemeElement,"view","");return this.areValuesEqual(i,n)};BX.UI.EntityEditorCustom.prototype.layout=function(t){if(this._hasLayout){return}var e=this._schemeElement.getDataArrayParam("classNames",[]);e.push("ui-entity-editor-field-text");this.ensureWrapperCreated({classNames:e});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}this._wrapper.appendChild(this.createTitleNode(this.getTitle()));this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"}});this._wrapper.appendChild(this._innerWrapper);if(this._mode===BX.UI.EntityEditorMode.edit){BX.addClass(this._innerWrapper,"ui-ctl-custom")}var i=this.getHtmlContent();if(BX.type.isNotEmptyString(i)){setTimeout(BX.delegate((function(){BX.html(this._innerWrapper,i);if(this._mode===BX.UI.EntityEditorMode.edit){BX.bindDelegate(this._innerWrapper,"bxchange",{tag:["input","select","textarea"]},this._changeHandler)}}),this),0)}else if(this._mode!==BX.UI.EntityEditorMode.edit){this._innerWrapper.appendChild(BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},text:BX.message("UI_ENTITY_EDITOR_FIELD_EMPTY")}))}if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorCustom.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorCustom.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorCustom.prototype.getHtmlContent=function(){return this._model.getSchemeField(this._schemeElement,this.isInEditMode()?"edit":"view","")};BX.UI.EntityEditorCustom.prototype.setRuntimeValue=function(t){this._runtimeValue=t};BX.UI.EntityEditorCustom.prototype.getRuntimeValue=function(){return this._mode===BX.UI.EntityEditorMode.edit?this._runtimeValue:""};BX.UI.EntityEditorCustom.prototype.validate=function(t){if(this._mode!==BX.UI.EntityEditorMode.edit){throw"BX.UI.EntityEditorCustom. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}return true};BX.UI.EntityEditorCustom.create=function(t,e){var i=new BX.UI.EntityEditorCustom;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorMoney==="undefined"){BX.UI.EntityEditorMoney=function(){BX.UI.EntityEditorMoney.superclass.constructor.apply(this);this._currencyEditor=null;this._amountWrapper=null;this._amountInput=null;this._currencyInput=null;this._sumElement=null;this._selectContainer=null;this._inputWrapper=null;this._innerWrapper=null;this._selectedCurrencyValue="";this._selectorClickHandler=BX.delegate(this.onSelectorClick,this);this._isCurrencyMenuOpened=false;this.wrapperClassName="ui-entity-editor-field-money"};BX.extend(BX.UI.EntityEditorMoney,BX.UI.EntityEditorField);BX.UI.EntityEditorMoney.prototype.getModeSwitchType=function(t){var e=BX.UI.EntityEditorModeSwitchType.common;if(t===BX.UI.EntityEditorMode.edit){e|=BX.UI.EntityEditorModeSwitchType.button|BX.UI.EntityEditorModeSwitchType.content}return e};BX.UI.EntityEditorMoney.prototype.getContentWrapper=function(){return this._innerWrapper};BX.UI.EntityEditorMoney.prototype.focus=function(){if(this._amountInput&&!this.isInputDisabled()){BX.focus(this._amountInput);BX.UI.EditorTextHelper.getCurrent().selectAll(this._amountInput)}};BX.UI.EntityEditorMoney.prototype.getValue=function(t){if(!this._model){return""}return this._model.getStringField(this.getAmountFieldName(),t!==undefined?t:"")};BX.UI.EntityEditorMoney.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated({classNames:[this.wrapperClassName]});this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this.getTitle();var i=this.getData();var n=BX.prop.getString(i,"amount");var r=BX.prop.getString(BX.prop.getObject(i,"currency"),"name");var o=this._model.getField(BX.prop.getString(BX.prop.getObject(i,"currency"),"name",""));if(!BX.type.isNotEmptyString(o)){o=BX.Currency.Editor.getBaseCurrencyId()}this._selectedCurrencyValue=o;var s=this._editor.findOption(o,BX.prop.getArray(BX.prop.getObject(i,"currency"),"items"));var a=this.getAmountFieldName();var l=this.getCurrencyFieldName();var d=this._model.getField(a,"");var h=this._model.getField(BX.prop.getString(i,"formatted"),"");this._amountWrapper=null;this._amountValue=null;this._amountInput=null;this._currencyInput=null;this._selectContainer=null;this._innerWrapper=null;this._sumElement=null;if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}if(this._mode===BX.UI.EntityEditorMode.edit){this._wrapper.appendChild(this.createTitleNode(e));this._amountValue=BX.create("input",{attrs:{name:n,type:"hidden",value:d}});this._amountInput=BX.create("input",{attrs:{className:"ui-ctl-element",type:"text",value:h}});this._amountWrapper=BX.create("div",{props:{className:"ui-ctl-inline ui-ctl-w75"},children:[this._amountInput]});BX.bind(this._amountInput,"input",this._changeHandler);if(this._model.isFieldLocked(a)){this.setInputDisabled(true)}this._currencyInput=BX.create("input",{attrs:{name:r,type:"hidden",value:o}});containerProps={props:{className:"ui-ctl-element"},text:s};this._select=BX.create("div",containerProps);this._selectIcon=BX.create("div",{attrs:{className:"ui-ctl-after ui-ctl-icon-angle"}});this._selectContainer=BX.create("div",{props:{className:"ui-ctl ui-ctl-inline ui-ctl-after-icon ui-ctl-dropdown ui-ctl-w33"},children:[this._select,this._selectIcon]});if(this._model.isFieldLocked(l)){this._select.disabled=true;this._selectContainer.disabled=true;this._selectContainer.classList.add("ui-ctl-disabled")}else{BX.bind(this._selectContainer,"click",this._selectorClickHandler)}this._inputWrapper=BX.create("div",{props:{className:"ui-ctl-inline ui-ctl-w100"},children:[this._amountValue,this._currencyInput,this._amountWrapper,this._selectContainer]});this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[this._inputWrapper]});this._currencyEditor=new BX.Currency.Editor({input:this._amountInput,currency:o,callback:BX.delegate(this.onAmountValueChange,this)});this._currencyEditor.changeValue()}else{this._wrapper.appendChild(this.createTitleNode(e));if(this.hasContentToDisplay()){var u="ui-entity-editor-content-block-wallet";var p=BX.prop.getBoolean(i,"largeFormat",false);if(p){u+=" ui-entity-editor-content-block-wallet-large"}this._sumElement=BX.create("span",{props:{className:u}});this._sumElement.innerHTML=this.renderMoney();this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},children:[BX.create("div",{props:{className:"ui-entity-editor-content-block-text"},children:[this._sumElement]})]})}else{this._innerWrapper=BX.create("div",{props:{className:"ui-entity-editor-content-block"},text:this.getMessage("isEmpty")})}}this._wrapper.appendChild(this._innerWrapper);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorMoney.prototype.doClearLayout=function(t){BX.PopupMenu.destroy(this._id);if(this._currencyEditor){this._currencyEditor.clean();this._currencyEditor=null}this._amountWrapper=null;this._amountValue=null;this._amountInput=null;this._currencyInput=null;this._sumElement=null;this._selectContainer=null;this._inputWrapper=null;this._innerWrapper=null};BX.UI.EntityEditorMoney.prototype.refreshLayout=function(t){if(!this._hasLayout){return}if(!this._isValidLayout){BX.UI.EntityEditorMoney.superclass.refreshLayout.apply(this,arguments);return}if(this._mode===BX.UI.EntityEditorMode.edit&&this._amountInput){var e=this._currencyEditor?this._currencyEditor.currency:this._model.getField(this.getCurrencyFieldName());if(!BX.type.isNotEmptyString(e)){e=BX.Currency.Editor.getBaseCurrencyId()}var i=this.getAmountFieldName();this._amountValue.value=this._model.getField(i);this._amountInput.value=BX.Currency.Editor.getFormattedValue(this._model.getField(i,""),e);this.setInputDisabled(this._model.isFieldLocked(i))}else if(this._mode===BX.UI.EntityEditorMode.view&&this._sumElement){this._sumElement.innerHTML=this.renderMoney()}};BX.UI.EntityEditorMoney.prototype.onAmountValueChange=function(t){if(!this._amountValue){return}var e=BX.prop.getObject(BX.Currency.Editor.currencyList,this._selectedCurrencyValue,null);if(e){t=BX.Currency.Editor.getFormattedValue(t,this._selectedCurrencyValue);t=t.replaceAll(e["SEPARATOR"],"")}this._amountValue.value=t};BX.UI.EntityEditorMoney.prototype.getAmountFieldName=function(){return this._schemeElement.getDataStringParam("amount","")};BX.UI.EntityEditorMoney.prototype.getCurrencyFieldName=function(){return BX.prop.getString(this._schemeElement.getDataObjectParam("currency",{}),"name","")};BX.UI.EntityEditorMoney.prototype.onSelectorClick=function(t){this.openCurrencyMenu()};BX.UI.EntityEditorMoney.prototype.openCurrencyMenu=function(){if(this._isCurrencyMenuOpened){return}var t=this._schemeElement.getData();var e=BX.prop.getArray(BX.prop.getObject(t,"currency"),"items");var i=0;var n=[];while(i<e.length){n.push({text:BX.util.htmlspecialchars(e[i]["NAME"]),value:BX.util.htmlspecialchars(e[i]["VALUE"]),onclick:BX.delegate(this.onCurrencySelect,this)});i++}BX.PopupMenu.show(this._id,this._selectContainer,n,{angle:false,width:this._selectContainer.offsetWidth+"px",events:{onPopupShow:BX.delegate(this.onCurrencyMenuOpen,this),onPopupClose:BX.delegate(this.onCurrencyMenuClose,this)}})};BX.UI.EntityEditorMoney.prototype.closeCurrencyMenu=function(){if(!this._isCurrencyMenuOpened){return}var t=BX.PopupMenu.getMenuById(this._id);if(t){t.popupWindow.close()}};BX.UI.EntityEditorMoney.prototype.onCurrencyMenuOpen=function(){BX.addClass(this._selectContainer,"active");this._isCurrencyMenuOpened=true};BX.UI.EntityEditorMoney.prototype.onCurrencyMenuClose=function(){BX.PopupMenu.destroy(this._id);BX.removeClass(this._selectContainer,"active");this._isCurrencyMenuOpened=false};BX.UI.EntityEditorMoney.prototype.onCurrencySelect=function(t,e){this.closeCurrencyMenu();this._selectedCurrencyValue=this._currencyInput.value=e.value;this._select.innerHTML=BX.util.htmlspecialchars(e.text);if(this._currencyEditor){this._currencyEditor.setCurrency(this._selectedCurrencyValue)}this.markAsChanged({fieldName:this.getCurrencyFieldName(),fieldValue:this._selectedCurrencyValue})};BX.UI.EntityEditorMoney.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getAmountFieldName()){return}this.refreshLayout()};BX.UI.EntityEditorMoney.prototype.processModelLock=function(t){var e=BX.prop.getString(t,"name","");if(this.getAmountFieldName()===e){this.refreshLayout()}};BX.UI.EntityEditorMoney.prototype.validate=function(t){if(!(this._mode===BX.UI.EntityEditorMode.edit&&this._amountInput&&this._amountValue)){throw"BX.UI.EntityEditorMoney. Invalid validation context"}this.clearError();if(this.hasValidators()){return this.executeValidators(t)}var e=!(this.isRequired()||this.isRequiredByAttribute())||BX.util.trim(this._amountValue.value)!=="";if(!e){t.addError(BX.UI.EntityValidationError.create({field:this}));this.showRequiredFieldError(this._inputWrapper)}return e};BX.UI.EntityEditorMoney.prototype.showError=function(t,e){BX.UI.EntityEditorMoney.superclass.showError.apply(this,arguments);if(this._amountInput){BX.addClass(this._amountInput,"ui-entity-editor-field-error")}};BX.UI.EntityEditorMoney.prototype.clearError=function(){BX.UI.EntityEditorMoney.superclass.clearError.apply(this);if(this._amountInput){BX.removeClass(this._amountInput,"ui-entity-editor-field-error")}};BX.UI.EntityEditorMoney.prototype.setInputDisabled=function(t){if(!this._amountInput||!this._amountWrapper){return}this._amountInput.readOnly=t;if(t){BX.Dom.addClass(this._amountWrapper,"ui-ctl-disabled")}else{BX.Dom.removeClass(this._amountWrapper,"ui-ctl-disabled")}};BX.UI.EntityEditorMoney.prototype.isInputDisabled=function(){return this._amountInput.readOnly};BX.UI.EntityEditorMoney.prototype.getRuntimeValue=function(){var t=[];if(this._mode===BX.UI.EntityEditorMode.edit){if(this._amountValue){t[BX.prop.getString(t,"amount")]=this._amountValue.value}t[BX.prop.getString(t,"currency")]=this._selectedCurrencyValue;return t}return""};BX.UI.EntityEditorMoney.prototype.save=function(){var t=this._schemeElement.getData();this._model.setField(BX.prop.getString(BX.prop.getObject(t,"currency"),"name"),this._selectedCurrencyValue,{originator:this});if(this._amountValue){this._model.setField(BX.prop.getString(t,"amount"),this._amountValue.value,{originator:this});this._model.setField(BX.prop.getString(t,"formatted"),"",{originator:this});this._editor.formatMoney(this._amountValue.value,this._selectedCurrencyValue,BX.delegate(this.onMoneyFormatRequestSuccess,this))}};BX.UI.EntityEditorMoney.prototype.onMoneyFormatRequestSuccess=function(t){var e=this._schemeElement.getData();var i=BX.type.isNotEmptyString(t["FORMATTED_SUM_WITH_CURRENCY"])?t["FORMATTED_SUM_WITH_CURRENCY"]:"";this._model.setField(BX.prop.getString(e,"formattedWithCurrency"),i);var n=BX.type.isNotEmptyString(t["FORMATTED_SUM"])?t["FORMATTED_SUM"]:"";this._model.setField(BX.prop.getString(e,"formatted"),n,{originator:this});if(this._sumElement){while(this._sumElement.firstChild){this._sumElement.removeChild(this._sumElement.firstChild)}this._sumElement.innerHTML=this.renderMoney()}};BX.UI.EntityEditorMoney.prototype.renderMoney=function(){var t=this._schemeElement.getData();var e=this._model.getField(BX.prop.getString(t,"formattedWithCurrency"),"");var i=this._model.getField(BX.prop.getString(t,"formatted"),"");var n=BX.Currency.Editor.trimTrailingZeros(i,this._selectedCurrencyValue);var r=BX.prop.getBoolean(t,"largeFormat",false);if(r){n='<span class="ui-entity-widget-content-block-columns-right">'+n+"</span>"}return e.replace(i,n)};BX.UI.EntityEditorMoney.create=function(t,e){var i=new BX.UI.EntityEditorMoney;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorUser==="undefined"){BX.UI.EntityEditorUser=function(){BX.UI.EntityEditorUser.superclass.constructor.apply(this);this._input=null;this._editButton=null;this._photoElement=null;this._nameElement=null;this._positionElement=null;this._selectedData={};this._editButtonClickHandler=BX.delegate(this.onEditBtnClick,this)};BX.extend(BX.UI.EntityEditorUser,BX.UI.EntityEditorField);BX.UI.EntityEditorUser.prototype.isSingleEditEnabled=function(){return true};BX.UI.EntityEditorUser.prototype.getRelatedDataKeys=function(){return[this.getDataKey(),this._schemeElement.getDataStringParam("formated",""),this._schemeElement.getDataStringParam("position",""),this._schemeElement.getDataStringParam("showUrl",""),this._schemeElement.getDataStringParam("photoUrl","")]};BX.UI.EntityEditorUser.prototype.hasContentToDisplay=function(){return true};BX.UI.EntityEditorUser.prototype.layout=function(t){if(this._hasLayout){return}this.ensureWrapperCreated();this.adjustWrapper();if(!this.isNeedToDisplay()){this.registerLayout(t);this._hasLayout=true;return}var e=this._schemeElement.getName();var i=this._schemeElement.getTitle();var n=this._model.getField(e);var r=this._model.getSchemeField(this._schemeElement,"formated","");var o=this._model.getSchemeField(this._schemeElement,"position","");var s=this._model.getSchemeField(this._schemeElement,"showUrl","","");var a=this._model.getSchemeField(this._schemeElement,"photoUrl","");this._photoElement=BX.create("a",{props:{className:"ui-entity-editor-user-avatar-container",target:"_blank"},style:{backgroundImage:BX.type.isNotEmptyString(a)?"url('"+encodeURI(a)+"')":"",backgroundSize:BX.type.isNotEmptyString(a)?"30px":""}});this._nameElement=BX.create("a",{props:{className:"ui-entity-editor-user-name",target:"_blank"},text:r});if(s!==""){this._photoElement.href=s;this._nameElement.href=s}this._positionElement=BX.create("SPAN",{props:{className:"ui-entity-editor-user-position"},text:o});if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}this._wrapper.appendChild(this.createTitleNode(i));var l=BX.create("div",{props:{className:"ui-entity-editor-user-container"}});this._editButton=null;this._input=null;if(this._mode===BX.UI.EntityEditorMode.edit||this.isEditInViewEnabled()&&!this.isReadOnly()){this._input=BX.create("input",{attrs:{name:e,type:"hidden",value:n}});this._wrapper.appendChild(this._input);this._editButton=BX.create("span",{props:{className:"ui-entity-editor-user-change"},text:BX.message("UI_ENTITY_EDITOR_CHANGE")});BX.bind(this._editButton,"click",this._editButtonClickHandler);l.appendChild(this._editButton)}l.appendChild(this._photoElement);l.appendChild(BX.create("span",{props:{className:"ui-entity-editor-user-info"},children:[this._nameElement,this._positionElement]}));this._wrapper.appendChild(BX.create("div",{props:{className:"ui-entity-editor-user-content-block-inner"},children:[l]}));if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}this.registerLayout(t);this._hasLayout=true};BX.UI.EntityEditorUser.prototype.doRegisterLayout=function(){if(this.isInEditMode()&&this.checkModeOption(BX.UI.EntityEditorModeOptions.individual)){window.setTimeout(BX.delegate(this.openSelector,this),0)}};BX.UI.EntityEditorUser.prototype.doClearLayout=function(t){this._input=null;this._editButton=null;this._photoElement=null;this._nameElement=null;this._positionElement=null};BX.UI.EntityEditorUser.prototype.onEditBtnClick=function(t){if(this._mode===BX.UI.EntityEditorMode.view&&this.isEditInViewEnabled()&&this.getEditor().isChanged()){this.switchToSingleEditMode()}else{this.openSelector()}};BX.UI.EntityEditorUser.prototype.openSelector=function(){BX.onCustomEvent(this._editor,"BX.UI.EntityEditorUser:openSelector",[this,{id:this._id,callback:BX.delegate(this.processItemSelect,this),anchor:this._editButton}])};BX.UI.EntityEditorUser.prototype.processItemSelect=function(t,e){var i=this._mode===BX.UI.EntityEditorMode.view;var n=this.isEditInViewEnabled();if(i&&!n){return}this._selectedData={id:BX.prop.getInteger(e,"entityId",0),photoUrl:BX.prop.getString(e,"avatar",""),formattedNameHtml:BX.prop.getString(e,"name",""),positionHtml:BX.prop.getString(e,"desc","")};this._input.value=this._selectedData["id"];this._photoElement.style.backgroundImage=this._selectedData["photoUrl"]!==""?"url('"+encodeURI(this._selectedData["photoUrl"])+"')":"";this._photoElement.style.backgroundSize=this._selectedData["photoUrl"]!==""?"30px":"";this._nameElement.innerHTML=this._selectedData["formattedNameHtml"];this._positionElement.innerHTML=this._selectedData["positionHtml"];BX.onCustomEvent(this._editor,"BX.UI.EntityEditorUser:closeSelector",[this,{id:this._id}]);if(!i){this.markAsChanged()}else{this._editor.saveControl(this)}};BX.UI.EntityEditorUser.prototype.save=function(){var t=this._schemeElement.getData();if(this._selectedData["id"]>0){var e=this._selectedData["id"];this._model.setField(BX.prop.getString(t,"formated"),BX.util.htmlspecialcharsback(this._selectedData["formattedNameHtml"]));this._model.setField(BX.prop.getString(t,"position"),this._selectedData["positionHtml"]!=="&nbsp;"?BX.util.htmlspecialcharsback(this._selectedData["positionHtml"]):"");this._model.setField(BX.prop.getString(t,"showUrl"),BX.prop.getString(t,"pathToProfile").replace(/#user_id#/gi,e));this._model.setField(BX.prop.getString(t,"photoUrl"),this._selectedData["photoUrl"]);this._model.setField(this.getName(),e)}};BX.UI.EntityEditorUser.prototype.processModelChange=function(t){if(BX.prop.get(t,"originator",null)===this){return}if(!BX.prop.getBoolean(t,"forAll",false)&&BX.prop.getString(t,"name","")!==this.getName()){return}this.refreshLayout()};BX.UI.EntityEditorUser.prototype.getRuntimeValue=function(){if(this._mode===BX.UI.EntityEditorMode.edit&&this._selectedData["id"]>0){return this._selectedData["id"]}return""};BX.UI.EntityEditorUser.prototype.getMessage=function(t){var e=BX.UI.EntityEditorUser.messages;return e.hasOwnProperty(t)?e[t]:BX.UI.EntityEditorUser.superclass.getMessage.apply(this,arguments)};if(typeof BX.UI.EntityEditorUser.messages==="undefined"){BX.UI.EntityEditorUser.messages={}}BX.UI.EntityEditorUser.create=function(t,e){var i=new BX.UI.EntityEditorUser;i.initialize(t,e);return i}}if(typeof BX.UI.EntityEditorProductRowSummary==="undefined"){BX.UI.EntityEditorProductRowSummary=function(){BX.UI.EntityEditorProductRowSummary.superclass.constructor.apply(this);this._availableProducts=null;this._productListOffset=0;this.productListLimit=3;this.totalCount=0;this._productSummaryContainer=null;this._productListContainer=null;this._moreButton=null};BX.extend(BX.UI.EntityEditorProductRowSummary,BX.UI.EntityEditorField);BX.UI.EntityEditorProductRowSummary.prototype.layout=function(t){if(this._hasLayout){return}const e=this._isNeedClearLayout(t);if(e){this.ensureWrapperCreated({});this.adjustWrapper()}if(e){if(this.isDragEnabled()){this._wrapper.appendChild(this.createDragButton())}this._wrapper.appendChild(this.createTitleNode(this.getTitle()))}this.updateProductSummaryContainer(this.getValue());if(e){this._wrapper.appendChild(this._productSummaryContainer);if(this.isContextMenuEnabled()){this._wrapper.appendChild(this.createContextMenuButton())}if(this.isDragEnabled()){this.initializeDragDropAbilities()}}this._hasLayout=true;this.registerLayout(t)};BX.UI.EntityEditorProductRowSummary.prototype.getProductListLength=function(){const t=this.getValue();return BX.prop.getArray(t,"items",[]).length};BX.UI.EntityEditorProductRowSummary.prototype.clearLayout=function(t){if(this._isNeedClearLayout(t)){return BX.UI.EntityEditorProductRowSummary.superclass.clearLayout.apply(this,arguments)}this._hasLayout=false};BX.UI.EntityEditorProductRowSummary.prototype._isNeedClearLayout=function(t){return!BX.prop.getBoolean(t,"preservePosition",false)||!BX.prop.getBoolean(t,"isRefreshViewModeLayout",false)};BX.UI.EntityEditorProductRowSummary.prototype.doClearLayout=function(){this._clearProductListData();this._productSummaryContainer=null;this._productListContainer=null;this._moreButton=null};BX.UI.EntityEditorProductRowSummary.prototype.getAvailableProductsToDisplay=function(){if(this._availableProducts===null){this.initProductListData()}return this._availableProducts};BX.UI.EntityEditorProductRowSummary.prototype._clearProductListData=function(){this._productListOffset=0;this.totalCount=0;this._availableProducts=null};BX.UI.EntityEditorProductRowSummary.prototype.initProductListData=function(t){if(!(t instanceof Array)){t=BX.prop.getArray(this.getValue(),"items",[])}this._availableProducts=t.slice(0,this.productListLimit*2)};BX.UI.EntityEditorProductRowSummary.prototype.updateProductSummaryContainer=function(t){const e=!(this._productSummaryContainer===null);if(!e){this._productSummaryContainer=BX.create("div",{props:{className:"ui-entity-editor-product-summary-container"}});this._currentData=t;this._previousData={}}else{BX.cleanNode(this._productSummaryContainer);this._previousData=this._currentData;this._currentData=t;this._productListContainer=null;this._clearProductListData()}this.totalCount=BX.prop.getNumber(t,"count",0);const i=BX.prop.getString(t,"total","");if(this.totalCount>0){const e=BX.create("span",{props:{className:"ui-enitity-editor-product-summary-total-info"},html:this._getTotalInfoPhraseTemplate(this.totalCount).replace(/#COUNT#/gi,this.totalCount).replace(/#TOTAL#/gi,i)});this._productSummaryContainer.appendChild(e);const n=BX.prop.getBoolean(t,"isReadOnly",true);if(!n){const t=BX.create("span",{props:{className:"ui-enitity-editor-product-summary-tab-link",onclick:()=>{this.openDetailProductList()}},text:BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_TAB_LINK_EDIT")});this._productSummaryContainer.appendChild(t)}const r=this.getAvailableProductsToDisplay();this.createProductListContainer(r);this._productSummaryContainer.appendChild(this._productListContainer);const o=Math.min(r.length,this.productListLimit);if(o<r.length){this._moreButton=this._getMoreButton();this._productSummaryContainer.appendChild(this._moreButton)}}else{const e=BX.prop.getBoolean(t,"isReadOnly",true);this._productSummaryContainer.appendChild(this._createEmptyListContainer(e,this.totalCount,i))}};BX.UI.EntityEditorProductRowSummary.prototype._getTotalInfoPhraseTemplate=function(t){const e=BX.message("LANGUAGE_ID");const i=BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_TOTAL_PLURAL_"+BX.Loc.getPluralForm(t,e));if(i){return i}return BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_TOTAL")};BX.UI.EntityEditorProductRowSummary.prototype._createEmptyListContainer=function(t,e,i){if(t){return BX.create("span",{props:{className:"ui-enitity-editor-product-summary-total-info"},html:BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_TOTAL").replace(/#COUNT#/gi,e).replace(/#TOTAL#/gi,i)})}return BX.create("div",{props:{className:"ui-entity-editor-product-summary-empty-list-container",onclick:()=>{this.addNewPositionInDetailProductList()}},children:[BX.create("span",{props:{className:"ui-entity-editor-product-summary-empty-list-title"},text:BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_TAB_LINK_ADD")})]})};BX.UI.EntityEditorProductRowSummary.prototype.createProductListContainer=function(t=[]){if(this._productListContainer!==null){return}this._productListContainer=BX.create("ul",{props:{className:"ui-entity-editor-product-list-container"}});const e=Math.min(t.length,this.productListLimit);for(let i=0;i<e;i++){this.addProductRow(t[i])}};BX.UI.EntityEditorProductRowSummary.prototype.addProductRow=function(t){if(this._productListContainer===null){return}const e=this._formatProductData(t);const i=BX.create("li",{props:{className:"ui-entity-editor-product-row-container"},children:[this._getProductPicture(e),this._getProductDetails(e)]});this._productListContainer.appendChild(i);this._productListOffset++};BX.UI.EntityEditorProductRowSummary.prototype._formatProductData=function(t){return{name:BX.prop.getString(t,"PRODUCT_NAME",""),url:BX.prop.getString(t,"URL",""),price:BX.prop.getString(t,"SUM",""),propertiesString:BX.prop.getString(t,"VARIATION_INFO",""),photo:BX.prop.getString(t,"PHOTO_URL","")}};BX.UI.EntityEditorProductRowSummary.prototype._getProductPicture=function(t){const{photo:e}=t;const i={props:{className:"ui-enitity-editor-product-photo"}};if(e!==""){i.style={backgroundImage:`url(${encodeURI(e)})`}}return BX.create("div",i)};BX.UI.EntityEditorProductRowSummary.prototype._getProductDetails=function(t){const{name:e,url:i,price:n,propertiesString:r}=t;const o=this._getProductTitle(e,i);const s=[];if(r!==""){s.push(BX.create("span",{props:{className:"ui-entity-editor-product-details-properties"},text:r}))}s.push(BX.create("span",{props:{className:"ui-entity-editor-product-details-price"},html:n}));const a=BX.create("div",{props:{className:"ui-enitity-editor-product-details"},children:s});return BX.create("div",{props:{className:"ui-enitity-editor-product-info"},children:[o,a]})};BX.UI.EntityEditorProductRowSummary.prototype._isShowProductLink=function(){const t=this._schemeElement&&this._schemeElement._settings&&BX.Type.isObject(this._schemeElement._settings)?this._schemeElement._settings:{};return BX.prop.getBoolean(t,"showProductLink",true)};BX.UI.EntityEditorProductRowSummary.prototype._getProductTitle=function(t,e=""){let i;if(typeof e==="string"&&e!==""&&this._isShowProductLink()){i=BX.create("a",{props:{className:"ui-entity-editor-product-title-link",href:e},text:t})}else{i=BX.create("span",{props:{className:"ui-entity-editor-product-title"},text:t})}return i};BX.UI.EntityEditorProductRowSummary.prototype._getMoreButton=function(){if(this._moreButton===null){const t=Math.min(this.totalCount,this.productListLimit*2);this._moreButton=BX.create("span",{props:{className:"ui-entity-editor-product-list-more-button",onclick:()=>{this._onMoreButtonClick()}},text:BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_MORE_BUTTON").replace("#COUNT#",t-this._productListOffset)})}return this._moreButton};BX.UI.EntityEditorProductRowSummary.prototype._onMoreButtonClick=function(){this._productListContainer.style.maxHeight=`${this._productListContainer.clientHeight}px`;const t=this.getAvailableProductsToDisplay();for(let e=this._productListOffset;e<t.length;e++){this.addProductRow(t[e])}const e=parseInt(this._productListContainer.style.maxHeight);setTimeout((()=>{this._productListContainer.style.maxHeight=`${2*e}px`}),0);BX.remove(this._moreButton);if(t.length<this.getProductListLength()){this._wrapper.appendChild(BX.create("span",{props:{className:"ui-entity-editor-product-list-more-button",onclick:()=>{this.openDetailProductList()}},text:BX.message("UI_ENTITY_EDITOR_PRODUCT_SUMMARY_FULL_BUTTON").replace(/#COUNT#/gi,this.totalCount)}))}};BX.UI.EntityEditorProductRowSummary.prototype.openDetailProductList=function(){BX.onCustomEvent(window,"BX.UI.EntityEditorProductRowSummary:onDetailProductListLinkClick",[this])};BX.UI.EntityEditorProductRowSummary.prototype.addNewPositionInDetailProductList=function(){BX.onCustomEvent(window,"BX.UI.EntityEditorProductRowSummary:onAddNewRowInProductList",[this])};BX.UI.EntityEditorProductRowSummary.prototype.hasContentToDisplay=function(){return true};BX.UI.EntityEditorProductRowSummary.create=function(t,e){let i=new BX.UI.EntityEditorProductRowSummary;i.initialize(t,e);return i}}
//# sourceMappingURL=control.map.js